Commit 35c58bb8 by Mac Stephens

Merge branch 'mac3'

Version 0.9.7 deployed to server, database updated on dbserver
parents 1a5d0980 6d54266c
object FViewAddCustomer: TFViewAddCustomer object FViewAddCustomer: TFViewAddCustomer
Width = 842 Width = 842
Height = 607 Height = 607
OnShow = WebFormShow CSSLibrary = cssBootstrap
ElementFont = efCSS
object lblFormState: TWebLabel
Left = 18
Top = 16
Width = 3
Height = 15
ElementID = 'lbl_form_state'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object dtpStartDate: TWebDateTimePicker object dtpStartDate: TWebDateTimePicker
Left = 19 Left = 19
Top = 216 Top = 216
...@@ -200,44 +210,6 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -200,44 +210,6 @@ object FViewAddCustomer: TFViewAddCustomer
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnEditClick OnClick = btnEditClick
end end
object pnlMessage: TWebPanel
Left = 324
Top = 19
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 5
ElementPosition = epRelative
Role = 'null'
TabOrder = 16
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 46
Height = 15
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'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'null'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object edtCustomerID: TWebDBEdit object edtCustomerID: TWebDBEdit
Left = 151 Left = 151
Top = 12 Top = 12
...@@ -274,7 +246,7 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -274,7 +246,7 @@ object FViewAddCustomer: TFViewAddCustomer
BorderColor = clSilver BorderColor = clSilver
ChildOrder = 11 ChildOrder = 11
ElementFont = efCSS ElementFont = efCSS
ElementHeaderClassName = 'thead-light sticky-top bg-light' ElementHeaderClassName = 'thead-light sticky-top bg-light border-light'
ElementPosition = epRelative ElementPosition = epRelative
ElementTableClassName = 'table table-striped table-hover table-bordered text-sm' ElementTableClassName = 'table table-striped table-hover table-bordered text-sm'
Footer.ButtonActiveElementClassName = 'btn btn-primary' Footer.ButtonActiveElementClassName = 'btn btn-primary'
...@@ -296,6 +268,7 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -296,6 +268,7 @@ object FViewAddCustomer: TFViewAddCustomer
Header.ListItemElementClassName = 'page-item' Header.ListItemElementClassName = 'page-item'
Header.ListLinkElementClassName = 'page-link' Header.ListLinkElementClassName = 'page-link'
WordWrap = True WordWrap = True
OnClickCell = wdbtcAddressesDblClickCell
OnDblClickCell = wdbtcAddressesDblClickCell OnDblClickCell = wdbtcAddressesDblClickCell
Columns = < Columns = <
item item
...@@ -350,6 +323,7 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -350,6 +323,7 @@ object FViewAddCustomer: TFViewAddCustomer
Width = 121 Width = 121
Height = 22 Height = 22
ChildOrder = 22 ChildOrder = 22
EditType = weNumeric
ElementID = 'edtshippingzip' ElementID = 'edtshippingzip'
Enabled = False Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -392,7 +366,6 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -392,7 +366,6 @@ object FViewAddCustomer: TFViewAddCustomer
SelLength = 0 SelLength = 0
SelStart = 0 SelStart = 0
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = memoAddressBlockChange
end end
object btnAdd: TWebButton object btnAdd: TWebButton
Left = 19 Left = 19
...@@ -470,18 +443,6 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -470,18 +443,6 @@ object FViewAddCustomer: TFViewAddCustomer
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnShipAddClick OnClick = btnShipAddClick
end end
object btn_confirm_delete: TWebButton
Left = 725
Top = 433
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object edtFirstLine: TWebEdit object edtFirstLine: TWebEdit
Left = 190 Left = 190
Top = 430 Top = 430
...@@ -513,12 +474,12 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -513,12 +474,12 @@ object FViewAddCustomer: TFViewAddCustomer
Top = 72 Top = 72
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
AutoEdit = False
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
Left = 532 Left = 532
Top = 126 Top = 126
end end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 426 Left = 426
Top = 132 Top = 132
...@@ -566,12 +527,12 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -566,12 +527,12 @@ object FViewAddCustomer: TFViewAddCustomer
end end
end end
object wdsShipTo: TWebDataSource object wdsShipTo: TWebDataSource
AutoEdit = False
DataSet = xdwdsShipTo DataSet = xdwdsShipTo
Left = 698 Left = 698
Top = 128 Top = 128
end end
object xdwdsShipTo: TXDataWebDataSet object xdwdsShipTo: TXDataWebDataSet
AfterEdit = xdwdsShipToAfterEdit
Left = 698 Left = 698
Top = 44 Top = 44
object xdwdsShipToADDRESS: TStringField object xdwdsShipToADDRESS: TStringField
...@@ -603,6 +564,7 @@ object FViewAddCustomer: TFViewAddCustomer ...@@ -603,6 +564,7 @@ object FViewAddCustomer: TFViewAddCustomer
Top = 42 Top = 42
end end
object wdsUsers: TWebDataSource object wdsUsers: TWebDataSource
AutoEdit = False
DataSet = xdwdsUsers DataSet = xdwdsUsers
Left = 776 Left = 776
Top = 144 Top = 144
......
<nav class="navbar navbar-expand navbar-light bg-light sticky-top" style="z-index: 100;">
<div class="container-fluid ps-0"> <nav class="navbar navbar-expand navbar-light bg-light sticky-top border-light" style="z-index: 100;">
<div id="view.login.message" class="alert alert-danger" <div class="container-fluid d-flex align-items-center ps-0 pe-0">
style="padding: 0.25rem 0.5rem; font-size: 0.875rem; line-height: 1.5; display: flex; align-items: center; margin: 0 0 0 60px; height: 32px; width: 400px;">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button> <!-- Left-aligned form state label -->
<span id="view.login.message.label"></span> <div class="me-auto ps-3">
</div> <label id="lbl_form_state" class="form-label mb-0 fw-bold text-uppercase text-nowrap text-danger" style="font-size: 16px;">View Mode</label>
<ul class="navbar-nav me-auto ps-2">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-primary btn-sm">Close</button>
</li>
</ul>
</div> </div>
<!-- Right-aligned buttons -->
<ul class="navbar-nav ms-auto pe-2 mb-0">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-primary btn-sm">Close</button>
</li>
</ul>
</div>
</nav> </nav>
<div class="row mx-5"> <div class="row mx-5">
<h4 class="custom-h4 mt-3">Customer Information</h4> <h4 class="custom-h4 mt-3">Customer Information</h4>
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer Num</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer Num</label>
<input id="edtcompanyid" class="form-control input-sm"style="width: 100px" required/> <input id="edtcompanyid" class="form-control input-sm"style="width: 100px" required/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quickbooks ID:</label>
<input id="edtqbid" class="form-control input-sm"style="width: 200px" required/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer Name:</label>
<input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Company Name.
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<input id="edtcompanyaccountname"type="text" class="form-control" style="width: 150px" required/>
<div class="invalid-feedback" id="shortnamefeedback" style="font-size: 15px;">
Please Provide a Company Account Name.
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Start Date:</label>
<input class="form-control input-sm" id="dtpstartdate" type="date" required>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">End Date:</label>
<input class="form-control input-sm" id="dtpenddate" type="date" required>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Phone:</label>
<input id="edtphone" type="text" class="form-control"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Fax:</label>
<input id="edtfax" class="form-control input-sm"style="width: 200px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Representative:</label>
<select id="wdblcbrep" class='form-select'></select>
</div>
</div> </div>
<h4 class="custom-h4 mt-3">Billing Information</h4> <div class="col-auto">
<hr class="custom-hr"> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Quickbooks ID:</label>
<div class="row"> <input id="edtqbid" class="form-control input-sm"style="width: 200px" required/>
<div class="col-auto"> </div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing Address:</label> <div class="col-auto">
<input id="edtbillingaddress" class="form-control input-sm" style="width: 300px" required/> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer Name:</label>
<div class="invalid-feedback" style="font-size: 15px;"> <input id="edtcompanyname" type="text" class="form-control" style="width: 300px;" required/>
Please Provide a Address. <div class="invalid-feedback" style="font-size: 15px;">
</div> Please Provide a Company Name.
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing City</label>
<input id="edtbillingcity" class="form-control input-sm" style="width: 250px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a City.
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing State:</label>
<input id="edtbillingstate" class="form-control input-sm" style="width: 100px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a State.
</div>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing Zip Code:</label>
<input id="edtbillingzip" class="form-control input-sm" style="width: 200px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Zip Code.
</div>
</div> </div>
<div class="col-auto"> </div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing Contact:</label> <div class="col-auto">
<input id="edtbillingcontact" class="form-control input-sm" style="width: 250px" required/> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Customer ID:</label>
<div class="invalid-feedback" style="font-size: 15px;"> <input id="edtcompanyaccountname"type="text" class="form-control" style="width: 150px" required/>
Please Provide a Billing Contact. <div class="invalid-feedback" id="shortnamefeedback" style="font-size: 15px;">
</div> Please Provide a Company Account Name.
</div> </div>
</div> </div>
<div class="row mt-3"> <div class="col-auto">
<div class="col-auto"> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Start Date:</label>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Billing Address Block</label> <input class="form-control input-sm" id="dtpstartdate" type="date" required>
<textarea id="memoaddressblock" class="form-control" style=" width: 500px; height: 150px;" required></textarea> </div>
<div class="invalid-feedback" style="font-size: 15px;"> <div class="col-auto">
Please Enter a Billing Address Block. <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">End Date:</label>
</div> <input class="form-control input-sm" id="dtpenddate" type="date" required>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Phone:</label>
<input id="edtphone" type="text" class="form-control"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Fax:</label>
<input id="edtfax" class="form-control input-sm"style="width: 200px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Representative:</label>
<select id="wdblcbrep" class='form-select'></select>
</div>
</div>
<h4 class="custom-h4 mt-3">Billing Information</h4>
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing Address:</label>
<input id="edtbillingaddress" class="form-control input-sm" style="width: 300px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Address.
</div> </div>
</div> </div>
<h4 class="custom-h4 mt-3">Shipping Addresses</h4> <div class="col-auto">
<hr class="custom-hr"> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing City</label>
<div class="row"> <input id="edtbillingcity" class="form-control input-sm" style="width: 250px" required/>
<table id="tblPhoneGrid" class="table table-striped table-bordered" style="width: 100%;"> <div class="invalid-feedback" style="font-size: 15px;">
<thead class="sticky-top thead-light"> Please Provide a City.
<tr style="font-size: 0.875rem;">
<!-- Table headers are dynamically generated -->
</tr>
</thead>
<tbody id="orderTableBody" class="align-middle">
<!-- Table rows are dynamically generated -->
</tbody>
</table>
</div>
<div class="row mt-1">
<div class="col-auto">
<button id="btnshipadd" class="btn btn-primary btn-sm">Add</button>
</div> </div>
<div class="col-auto"> </div>
<button id="btnshipedit" class="btn btn-primary btn-sm">Edit</button> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing State:</label>
<input id="edtbillingstate" class="form-control input-sm" style="width: 100px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a State.
</div> </div>
<div class="col-auto"> </div>
<button id="btnshipdelete" class="btn btn-danger btn-sm">Delete</button> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing Zip Code:</label>
<input id="edtbillingzip" class="form-control input-sm" style="width: 200px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Zip Code.
</div> </div>
<div class="col-auto"> </div>
<button id="btnshipconfirm" class="btn btn-success btn-sm">Save</button> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Billing Contact:</label>
<input id="edtbillingcontact" class="form-control input-sm" style="width: 250px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Provide a Billing Contact.
</div> </div>
<div class="col-auto"> </div>
<button id="btnshipcancel" class="btn btn-danger btn-sm">Cancel</button> </div>
<div class="row mt-3">
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Billing Address Block</label>
<textarea id="memoaddressblock" class="form-control" style=" width: 500px; height: 150px;" required></textarea>
<div class="invalid-feedback" style="font-size: 15px;">
Please Enter a Billing Address Block.
</div> </div>
</div> </div>
<div class="row mt-3"> </div>
<div class="col-auto"> <h4 class="custom-h4 mt-3">Shipping Addresses</h4>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">First Line:</label> <hr class="custom-hr">
<input id="edtfirstline" class="form-control input-sm" style="width: 300px" required/> <div class="row">
<div class="invalid-feedback" style="font-size: 15px;"> <div class="overflow-auto mt-2"
Please Enter the First Line. style="max-height: calc(100vh - 250px); padding-bottom: 0; width: 100%;">
</div> <table id="tblPhoneGrid" class="table table-striped table-bordered" style="width: 100%;">
<thead class="sticky-top thead-light">
<tr style="font-size: 0.875rem;">
<!-- headers -->
</tr>
</thead>
<tbody id="orderTableBody" class="align-middle">
<!-- rows -->
</tbody>
</table>
</div>
</div>
<div class="row mt-1">
<div class="col-auto">
<button id="btnshipadd" class="btn btn-primary btn-sm">Add</button>
</div>
<div class="col-auto">
<button id="btnshipedit" class="btn btn-primary btn-sm">Edit</button>
</div>
<div class="col-auto">
<button id="btnshipdelete" class="btn btn-danger btn-sm">Delete</button>
</div>
<div class="col-auto">
<button id="btnshipconfirm" class="btn btn-success btn-sm">Save</button>
</div>
<div class="col-auto">
<button id="btnshipcancel" class="btn btn-danger btn-sm">Cancel</button>
</div>
</div>
<div class="row mt-3">
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">First Line:</label>
<input id="edtfirstline" class="form-control input-sm" style="width: 300px" required/>
<div class="invalid-feedback" style="font-size: 15px;">
Please Enter the First Line.
</div> </div>
<div class="col-auto"> </div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Address:</label> <div class="col-auto">
<input id="edtshippingaddress" class="form-control input-sm" style="width: 300px" required/> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Address:</label>
<div class="invalid-feedback" style="font-size: 15px;"> <input id="edtshippingaddress" class="form-control input-sm" style="width: 300px" required/>
Please Enter an Address. <div class="invalid-feedback" style="font-size: 15px;">
</div> Please Enter an Address.
</div> </div>
<div class="col-auto"> </div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">City</label> <div class="col-auto">
<input id="edtshippingcity" class="form-control input-sm" style="width: 250px" required/> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">City</label>
<div class="invalid-feedback" style="font-size: 15px;"> <input id="edtshippingcity" class="form-control input-sm" style="width: 250px" required/>
Please Enter a City. <div class="invalid-feedback" style="font-size: 15px;">
</div> Please Enter a City.
</div> </div>
<div class="col-auto"> </div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">State:</label> <div class="col-auto">
<input id="edtshippingstate" class="form-control input-sm" style="width: 100px" required/> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">State:</label>
<div class="invalid-feedback" style="font-size: 15px;"> <input id="edtshippingstate" class="form-control input-sm" style="width: 100px" required/>
Please Enter a State. <div class="invalid-feedback" style="font-size: 15px;">
</div> Please Enter a State.
</div> </div>
<div class="col-auto"> </div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Zip Code:</label> <div class="col-auto">
<input id="edtshippingzip" class="form-control input-sm" style="width: 200px" required/> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Zip Code:</label>
<div class="invalid-feedback" style="font-size: 15px;"> <input id="edtshippingzip" class="form-control input-sm" style="width: 200px" required/>
Please Enter a Zip Code. <div class="invalid-feedback" style="font-size: 15px;">
</div> Please Enter a Zip Code.
</div> </div>
<div class="col-auto"> </div>
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Contact:</label> <div class="col-auto">
<input id="edtshippingcontact" class="form-control input-sm" style="width: 250px" required/> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Contact:</label>
<div class="invalid-feedback" style="font-size: 15px;"> <input id="edtshippingcontact" class="form-control input-sm" style="width: 250px" required/>
Please Enter a Shipping Contact. <div class="invalid-feedback" style="font-size: 15px;">
</div> Please Enter a Shipping Contact.
</div> </div>
</div> </div>
<div class="row my-3"> </div>
<div class="col-auto"> <div class="row my-3">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Shipping Block</label> <div class="col-auto">
<textarea id="memoshipblock" class="form-control" style=" width: 500px; height: 150px;" required></textarea> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Shipping Block</label>
<div class="invalid-feedback" style="font-size: 15px;"> <textarea id="memoshipblock" class="form-control" style=" width: 500px; height: 150px;" required></textarea>
Please Enter a Shipping Block. <div class="invalid-feedback" style="font-size: 15px;">
</div> Please Enter a Shipping Block.
</div> </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">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmation_modal_label">Confirm</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="modal_body">
Are you sure you want to delete this order?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id= 'btn_confirm_cancel'>Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_delete">Delete</button>
</div>
</div>
</div>
</div>
<style>
.modal-backdrop {
opacity: 0 !important;
}
</style>
...@@ -9,7 +9,7 @@ uses ...@@ -9,7 +9,7 @@ uses
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage, WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls, ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, WEBLib.Grids; Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, WEBLib.Grids, VCL.Forms;
type type
TFViewAddCustomer = class(TWebForm) TFViewAddCustomer = class(TWebForm)
...@@ -29,9 +29,6 @@ type ...@@ -29,9 +29,6 @@ type
btnDelete: TWebButton; btnDelete: TWebButton;
btnClose: TWebButton; btnClose: TWebButton;
btnEdit: TWebButton; btnEdit: TWebButton;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
WebDataSource1: TWebDataSource; WebDataSource1: TWebDataSource;
XDataWebDataSet1: TXDataWebDataSet; XDataWebDataSet1: TXDataWebDataSet;
...@@ -73,7 +70,6 @@ type ...@@ -73,7 +70,6 @@ type
btnShipDelete: TWebButton; btnShipDelete: TWebButton;
btnShipEdit: TWebButton; btnShipEdit: TWebButton;
btnShipAdd: TWebButton; btnShipAdd: TWebButton;
btn_confirm_delete: TWebButton;
tmrReturn: TWebTimer; tmrReturn: TWebTimer;
edtFirstLine: TWebEdit; edtFirstLine: TWebEdit;
wdsUsers: TWebDataSource; wdsUsers: TWebDataSource;
...@@ -82,32 +78,25 @@ type ...@@ -82,32 +78,25 @@ type
xdwdsUsersuserID: TStringField; xdwdsUsersuserID: TStringField;
XDataWebDataSet1REP_USER_ID: TStringField; XDataWebDataSet1REP_USER_ID: TStringField;
xdwdsUsersfull_name: TStringField; xdwdsUsersfull_name: TStringField;
procedure WebFormShow(Sender: TObject); lblFormState: TWebLabel;
procedure btnCloseNotificationClick(Sender: TObject);
procedure btnSaveClick(Sender: TObject); procedure btnSaveClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure xdwdsShipToAfterEdit(DataSet: TDataSet);
procedure XDataWebDataSet1AfterEdit(DataSet: TDataSet);
procedure btnCloseClick(Sender: TObject); procedure btnCloseClick(Sender: TObject);
procedure btnEditClick(Sender: TObject); procedure btnEditClick(Sender: TObject);
procedure wdbtcAddressesDblClickCell(Sender: TObject; ACol, ARow: Integer); procedure wdbtcAddressesDblClickCell(Sender: TObject; ACol, ARow: Integer);
procedure btnClearClick(Sender: TObject); procedure btnClearClick(Sender: TObject);
procedure memoAddressBlockChange(Sender: TObject);
procedure AddressEditMode(); procedure AddressEditMode();
procedure edtShippingAddressChange(Sender: TObject); procedure edtShippingAddressChange(Sender: TObject);
procedure btnAddClick(Sender: TObject); procedure btnAddClick(Sender: TObject);
procedure btn_confirm_deleteClick(Sender: TObject);
procedure tmrReturnTimer(Sender: TObject); procedure tmrReturnTimer(Sender: TObject);
procedure btnDeleteClick(Sender: TObject); procedure btnDeleteClick(Sender: TObject);
procedure btnShipAddClick(Sender: TObject); procedure btnShipAddClick(Sender: TObject);
procedure btnShipEditClick(Sender: TObject); procedure btnShipEditClick(Sender: TObject);
procedure btnShipSaveClick(Sender: TObject); [async] procedure btnShipSaveClick(Sender: TObject);
procedure btnShipDeleteClick(Sender: TObject); procedure btnShipDeleteClick(Sender: TObject);
procedure btnShipCancelClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure ViewMode(); procedure ViewMode();
procedure EditMode(); procedure EditMode();
[async] procedure GetCustomer(); [async] procedure GetCustomer();
...@@ -118,6 +107,7 @@ type ...@@ -118,6 +107,7 @@ type
function VerifyAddress(): boolean; function VerifyAddress(): boolean;
procedure Clear(); procedure Clear();
procedure ShowSelectCustomerForm(); procedure ShowSelectCustomerForm();
[async] procedure InitializeForm;
var var
customerID: string; customerID: string;
notification: string; notification: string;
...@@ -137,6 +127,45 @@ implementation ...@@ -137,6 +127,45 @@ implementation
uses View.Main, View.Customers, View.SelectCustomer, Utils; uses View.Main, View.Customers, View.SelectCustomer, Utils;
class function TFViewAddCustomer.CreateForm(AElementID, customerInfo, info: string): TWebForm;
begin
Application.CreateForm(TFViewAddCustomer, AElementID, Result,
procedure(AForm: TObject)
begin
with TFViewAddCustomer(AForm) do
begin
customerID := customerInfo;
notification := info;
InitializeForm;
end;
end
);
end;
[async] procedure TFViewAddCustomer.InitializeForm;
begin
if customerID = '' then
mode := 'ADD'
else
mode := 'EDIT';
if notification <> '' then
ShowToast(notification);
if mode = 'ADD' then
EditMode()
else
ViewMode();
await(GetCustomer);
dtpStartDate.Date := 0;
dtpEndDate.Date := 0;
end;
procedure TFViewAddCustomer.Clear(); procedure TFViewAddCustomer.Clear();
// Clears the shipping address fields. // Clears the shipping address fields.
begin begin
...@@ -159,6 +188,7 @@ begin ...@@ -159,6 +188,7 @@ begin
newform.Caption := 'Select Customer and Order Type'; newform.Caption := 'Select Customer and Order Type';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
window.location.hash := 'subform'; window.location.hash := 'subform';
...@@ -180,7 +210,7 @@ begin ...@@ -180,7 +210,7 @@ begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelShippingAddress', Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelShippingAddress',
[xdwdsShipTo.FieldByName('ship_id').AsString, customerID])); [xdwdsShipTo.FieldByName('ship_id').AsString, customerID]));
notification := TJSObject(Response.Result); notification := TJSObject(Response.Result);
ShowNotification(string(notification['status'])); ShowToast(string(notification['status']));
xdwdsShipTo.Close; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(notification['ADDRESS']); xdwdsShipTo.SetJSONData(notification['ADDRESS']);
xdwdsShipTo.Open; xdwdsShipTo.Open;
...@@ -222,7 +252,7 @@ begin ...@@ -222,7 +252,7 @@ begin
[AddressJSON.ToString])); [AddressJSON.ToString]));
notification := TJSObject(Response.Result); notification := TJSObject(Response.Result);
ShowNotification(string(notification['status'])); ShowToast(string(notification['status']));
xdwdsShipTo.Close; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(notification['ADDRESS']); xdwdsShipTo.SetJSONData(notification['ADDRESS']);
xdwdsShipTo.Open; xdwdsShipTo.Open;
...@@ -234,19 +264,28 @@ begin ...@@ -234,19 +264,28 @@ begin
ShowSelectCustomerForm(); ShowSelectCustomerForm();
end; end;
procedure TFViewAddCustomer.btnCancelClick(Sender: TObject); procedure TFViewAddCustomer.btnCancelClick(Sender: TObject);
// Shows a pop-up to confirm the user would like to cancel their changes.
begin begin
document.getElementById('modal_body').innerHTML := 'Are you sure you want to cancel all changes to the customer?'; ShowConfirmationModal(
document.getElementById('btn_confirm_cancel').innerText := 'No'; 'Are you sure you want to cancel all changes to the customer?',
document.getElementById('btn_confirm_delete').innerText := 'Yes'; 'Yes',
asm 'No',
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), { procedure(confirmed: Boolean)
keyboard: false }); begin
confirmationModal.show(); if confirmed then
end; begin
FViewMain.change := false;
if CustomerID <> '' then
FViewMain.ViewAddCustomer(CustomerID, 'Failure: Changes Discarded')
else
FViewMain.ShowForm(TFViewCustomers);
end;
end);
end; end;
procedure TFViewAddCustomer.btnClearClick(Sender: TObject); procedure TFViewAddCustomer.btnClearClick(Sender: TObject);
// Clears the shipping address fields. // Clears the shipping address fields.
begin begin
...@@ -259,17 +298,13 @@ begin ...@@ -259,17 +298,13 @@ begin
FViewMain.ShowForm(TFViewCustomers) FViewMain.ShowForm(TFViewCustomers)
end; end;
procedure TFViewAddCustomer.btnCloseNotificationClick(Sender: TObject);
// Closes a Notification.
begin
HideNotification();
end;
procedure TFViewAddCustomer.btnDeleteClick(Sender: TObject); procedure TFViewAddCustomer.btnDeleteClick(Sender: TObject);
// Eventually will delete customers after a confirmation // Eventually will delete customers after a confirmation
// TODO implement deleting customers // TODO implement deleting customers
begin begin
ShowMessage('Deleting Customers Is Not Yet Available'); ShowToast('Deleting Customers Is Not Yet Available', 'danger');
Exit;
end; end;
procedure TFViewAddCustomer.btnEditClick(Sender: TObject); procedure TFViewAddCustomer.btnEditClick(Sender: TObject);
...@@ -284,119 +319,29 @@ begin ...@@ -284,119 +319,29 @@ begin
AddressEditMode(); AddressEditMode();
end; end;
procedure TFViewAddCustomer.EditMode;
// Enables Customer Fields while disabling shipping address fields.
begin
FViewMain.change := true;
btnAdd.Enabled := false;
btnDelete.Enabled := false;
btnClose.Enabled := false;
btnSave.Enabled := true;
btnCancel.Enabled := True;
btnEdit.Enabled := false;
// Disable Shipping Address Editting
edtShippingAddress.Enabled := false;
edtShippingCity.Enabled := false;
edtShippingState.Enabled := false;
edtShippingZip.Enabled := false;
edtShippingContact.Enabled := false;
edtFirstLine.Enabled := false;
btnShipDelete.Enabled := false;
btnShipSave.Enabled := false;
btnShipCancel.Enabled := false;
btnShipEdit.Enabled := false;
btnShipAdd.Enabled := false;
end;
procedure TFViewAddCustomer.AddressEditMode;
// Enables Shipping Address fields while disabling customer fields.
begin
FViewMain.change := true;
btnDelete.Enabled := false;
btnClose.Enabled := false;
btnSave.Enabled := false;
btnCancel.Enabled := false;
btnEdit.Enabled := false;
btnAdd.Enabled := false;
btnShipDelete.Enabled := false;
btnShipSave.Enabled := true;
btnShipCancel.Enabled := true;
btnShipEdit.Enabled := false;
btnShipAdd.Enabled := false;
edtShippingAddress.Enabled := true;
edtShippingCity.Enabled := true;
edtShippingState.Enabled := true;
edtShippingZip.Enabled := true;
edtShippingContact.Enabled := true;
edtFirstLine.Enabled := true;
edtName.Enabled := false;
edtShortName.Enabled := false;
edtBillAddress.Enabled := false;
edtBillCity.Enabled := false;
edtBillState.Enabled := false;
edtBillZip.Enabled := false;
edtBillContact.Enabled := false;
dtpStartDate.Enabled := false;
dtpEndDate.Enabled := false;
edtFax.Enabled := false;
edtPhone.enabled := false;
wdblcbRep.Enabled := false;
end;
procedure TFViewAddCustomer.ViewMode;
// Enables Customer Fields while disabling shipping address fields.
begin
btnAdd.Enabled := true;
btnDelete.Enabled := true;
btnClose.Enabled := true;
btnSave.Enabled := false;
btnCancel.Enabled := false;
btnEdit.Enabled := true;
FViewMain.change := false;
btnShipAdd.Enabled := true;
if ( not xdwdsShipTo.IsEmpty ) then
btnShipDelete.Enabled := true;
btnShipSave.Enabled := false;
btnShipCancel.Enabled := false;
btnShipEdit.Enabled := true;
FViewMain.change := false;
edtName.Enabled := true;
edtShortName.Enabled := true;
edtBillAddress.Enabled := true;
edtBillCity.Enabled := true;
edtBillState.Enabled := true;
edtBillZip.Enabled := true;
edtBillContact.Enabled := true;
dtpStartDate.Enabled := true;
dtpEndDate.Enabled := true;
edtFax.Enabled := true;
edtPhone.enabled := true;
wdblcbRep.Enabled := true;
end;
procedure TFViewAddCustomer.wdbtcAddressesDblClickCell(Sender: TObject; ACol, procedure TFViewAddCustomer.wdbtcAddressesDblClickCell(Sender: TObject; ACol,
ARow: Integer); ARow: Integer);
// Retrieves the shipping address allowing it to be edited. // Retrieves the shipping address allowing it to be edited.
begin begin
xdwdsShipTo.Locate('ship_id', wdbtcAddresses.Cells[0, ARow], []); xdwdsShipTo.Locate('ship_id', wdbtcAddresses.Cells[0, ARow], []);
edtShippingAddress.Text := xdwdsShipTo.FieldByName('shipping_address').AsString; edtShippingAddress.Text := xdwdsShipTo.FieldByName('shipping_address').AsString;
edtShippingCity.Text := xdwdsShipTo.FieldByName('city').AsString; edtShippingCity.Text := xdwdsShipTo.FieldByName('city').AsString;
edtShippingState.Text := xdwdsShipTo.FieldByName('state').AsString; edtShippingState.Text := xdwdsShipTo.FieldByName('state').AsString;
edtShippingZip.Text := xdwdsShipTo.FieldByName('zip').AsString; edtShippingZip.Text := xdwdsShipTo.FieldByName('zip').AsString;
edtShippingContact.Text := xdwdsShipTo.FieldByName('contact').AsString; edtShippingContact.Text := xdwdsShipTo.FieldByName('contact').AsString;
memoShipBlock.Text := xdwdsShipTo.FieldByName('ADDRESS').AsString; memoShipBlock.Text := xdwdsShipTo.FieldByName('ADDRESS').AsString;
edtFirstLine.Text := memoShipBlock.Lines[0];
if memoShipBlock.Lines.Count > 0 then
edtFirstLine.Text := memoShipBlock.Lines[0]
else
edtFirstLine.Text := '';
btnShipEdit.Enabled := true;
end; end;
procedure TFViewAddCustomer.SendCustomerToServer(); procedure TFViewAddCustomer.SendCustomerToServer();
// Creates the customer JSON and then sends it to the server. // Creates the customer JSON and then sends it to the server.
var var
...@@ -460,7 +405,7 @@ begin ...@@ -460,7 +405,7 @@ begin
edtCustomerID.Text := CustomerID; edtCustomerID.Text := CustomerID;
ShowNotification(msg); ShowToast(msg);
//TODO update the BILL_ADDRESS_BLOCK memo after saving. //TODO update the BILL_ADDRESS_BLOCK memo after saving.
...@@ -480,6 +425,7 @@ begin ...@@ -480,6 +425,7 @@ begin
if VerifyCustomer() then if VerifyCustomer() then
begin begin
sendCustomerToServer(); sendCustomerToServer();
GetCustomer();
ViewMode(); ViewMode();
end; end;
end; end;
...@@ -492,19 +438,43 @@ begin ...@@ -492,19 +438,43 @@ begin
AddressEditMode(); AddressEditMode();
end; end;
procedure TFViewAddCustomer.btnShipCancelClick(Sender: TObject);
begin
ShowConfirmationModal(
'Are you sure you want to cancel address editing?',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
begin
shipmode := '';
Clear();
ViewMode();
end;
end);
end;
procedure TFViewAddCustomer.btnShipDeleteClick(Sender: TObject); procedure TFViewAddCustomer.btnShipDeleteClick(Sender: TObject);
// Allows the user to delete a Shipping Address.
begin begin
document.getElementById('modal_body').innerHTML := 'Are you sure you want to delete this address?'; ShowConfirmationModal(
document.getElementById('btn_confirm_cancel').innerText := 'Cancel'; 'Are you sure you want to delete this address?',
document.getElementById('btn_confirm_delete').innerText := 'Delete'; 'Delete',
asm 'Cancel',
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), { procedure(confirmed: Boolean)
keyboard: false }); begin
confirmationModal.show(); if confirmed then
end; begin
Utils.ShowSpinner('spinner');
DelAddress();
end;
end);
end; end;
procedure TFViewAddCustomer.btnShipEditClick(Sender: TObject); procedure TFViewAddCustomer.btnShipEditClick(Sender: TObject);
// Sets the form into AddressEdit mode. // Sets the form into AddressEdit mode.
begin begin
...@@ -512,92 +482,35 @@ begin ...@@ -512,92 +482,35 @@ begin
AddressEditMode(); AddressEditMode();
end; end;
procedure TFViewAddCustomer.btnShipSaveClick(Sender: TObject); [async] procedure TFViewAddCustomer.btnShipSaveClick(Sender: TObject);
// After Verifying the Address it sends the address down to the server.
begin begin
if VerifyAddress() then if (customerID = '') then
begin begin
SendAddressToServer(); ShowErrorModal('Cannot save address: Customer ID is not set.');
Clear(); Exit;
ViewMode();
end; end;
end; console.log('Saving address. CustomerID = ' + customerID);
procedure TFViewAddCustomer.btn_confirm_deleteClick(Sender: TObject); if VerifyAddress() then
// Modal Confirmation button. Checks if the user is cancelling changes, or
// Deleting a shipping address/ customer
begin
FViewMain.change := false;
if document.getElementById('btn_confirm_delete').innerText = 'Yes' then
// checks if the user is canceling or deleting
begin
if CustomerID <> '' then
begin
FViewMain.ViewAddCustomer(CustomerID, 'Failure:Changes Discarded');
end
else
FViewMain.ShowForm(TFViewCustomers);
end
else if document.getElementById('modal_body').innerHTML.Contains('customer') then
// checks if the user is deleting a customer or a shipping address
begin
asm
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), {
keyboard: false });
confirmationModal.hide();
end;
Utils.ShowSpinner('spinner');
//delCustomer();
tmrReturn.Enabled := true;
end
else
begin begin
asm await(SendAddressToServer);
var confirmationModal = new bootstrap.Modal(document.getElementById('confirmation_modal'), { Clear();
keyboard: false }); await(GetCustomer); // Ensures xdwdsShipTo is refreshed with server data
confirmationModal.hide(); ViewMode();
end;
Utils.ShowSpinner('spinner');
delAddress();
end; end;
end; end;
class function TFViewAddCustomer.CreateForm(AElementID: string; customerInfo: string; info: string): TWebForm;
// Creates the Add Customer form. Setting the customer id so the customer can be
// Retrieved and the notification to be shown.
begin
Application.CreateForm(TFViewAddCustomer, AElementID, Result,
procedure(AForm: TObject)
begin
with TFViewAddCustomer(AForm) do
begin
TFViewAddCustomer(AForm).customerID := customerInfo;
TFViewAddCustomer(AForm).notification := info;
end;
end
);
end;
procedure TFViewAddCustomer.GetCustomer; procedure TFViewAddCustomer.GetCustomer;
// Retrieves a customer for a given CustomerID. // Retrieves a customer for a given CustomerID.
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customer : TJSObject; customer : TJSObject;
address: string;
items: TJSObject; items: TJSObject;
ship_block: TStringList; ship_block: TStringList;
begin begin
if CustomerID = '' then xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer', [customerID]));
begin
mode := 'ADD';
end
else
mode := 'EDIT';
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer',
[customerID]));
customer := TJSObject(xdcResponse.Result); customer := TJSObject(xdcResponse.Result);
console.log(customer);
xdwdsUsers.Close; xdwdsUsers.Close;
xdwdsUsers.SetJSONData(customer['USERS']); xdwdsUsers.SetJSONData(customer['USERS']);
...@@ -632,81 +545,6 @@ begin ...@@ -632,81 +545,6 @@ begin
edtFirstLine.Text := memoShipBlock.Lines[0] edtFirstLine.Text := memoShipBlock.Lines[0]
else else
edtFirstLine.Text := ''; edtFirstLine.Text := '';
end;
procedure TFViewAddCustomer.WebFormShow(Sender: TObject);
// Sets the form up whenever it is shown.
var
SQL: string;
begin
if customerID = '' then
mode := 'ADD'
else
mode := 'EDIT';
if notification = '' then
hideNotification()
else
showNotification(notification);
if mode = 'ADD' then
EditMode()
else
ViewMode();
getCustomer();
dtpStartDate.Date := 0;
dtpEndDate.Date := 0;
end;
procedure TFViewAddCustomer.XDataWebDataSet1AfterEdit(DataSet: TDataSet);
begin
EditMode();
end;
procedure TFViewAddCustomer.xdwdsShipToAfterEdit(DataSet: TDataSet);
begin
EditMode();
end;
procedure TFViewAddCustomer.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFViewAddCustomer.memoAddressBlockChange(Sender: TObject);
begin
EditMode();
end;
procedure TFViewAddCustomer.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end; end;
procedure TFViewAddCustomer.tmrReturnTimer(Sender: TObject); procedure TFViewAddCustomer.tmrReturnTimer(Sender: TObject);
...@@ -854,4 +692,124 @@ begin ...@@ -854,4 +692,124 @@ begin
end; end;
procedure TFViewAddCustomer.EditMode;
// Enables Customer Fields while disabling shipping address fields.
begin
XDataWebDataSet1.Edit;
FViewMain.change := true;
btnAdd.Enabled := false;
btnDelete.Enabled := false;
btnClose.Enabled := false;
btnSave.Enabled := true;
btnCancel.Enabled := True;
btnEdit.Enabled := false;
// Disable Shipping Address Editting
edtShippingAddress.Enabled := false;
edtShippingCity.Enabled := false;
edtShippingState.Enabled := false;
edtShippingZip.Enabled := false;
edtShippingContact.Enabled := false;
edtFirstLine.Enabled := false;
btnShipDelete.Enabled := false;
btnShipSave.Enabled := false;
btnShipCancel.Enabled := false;
btnShipEdit.Enabled := false;
btnShipAdd.Enabled := false;
lblFormState.Caption := 'Edit Mode';
lblFormState.ElementHandle.classList.remove('text-danger');
lblFormState.ElementHandle.classList.add('text-success');
end;
procedure TFViewAddCustomer.AddressEditMode;
// Enables Shipping Address fields while disabling customer fields.
begin
xdwdsShipTo.Edit;
FViewMain.change := true;
btnDelete.Enabled := false;
btnClose.Enabled := false;
btnSave.Enabled := false;
btnCancel.Enabled := false;
btnEdit.Enabled := false;
btnAdd.Enabled := false;
btnShipDelete.Enabled := false;
btnShipSave.Enabled := true;
btnShipCancel.Enabled := true;
btnShipEdit.Enabled := false;
btnShipAdd.Enabled := false;
edtShippingAddress.Enabled := true;
edtShippingCity.Enabled := true;
edtShippingState.Enabled := true;
edtShippingZip.Enabled := true;
edtShippingContact.Enabled := true;
edtFirstLine.Enabled := true;
edtName.Enabled := false;
edtShortName.Enabled := false;
edtBillAddress.Enabled := false;
edtBillCity.Enabled := false;
edtBillState.Enabled := false;
edtBillZip.Enabled := false;
edtBillContact.Enabled := false;
dtpStartDate.Enabled := false;
dtpEndDate.Enabled := false;
edtFax.Enabled := false;
edtPhone.enabled := false;
wdblcbRep.Enabled := false;
lblFormState.Caption := 'Edit Address';
lblFormState.ElementHandle.classList.remove('text-danger');
lblFormState.ElementHandle.classList.add('text-success');
end;
procedure TFViewAddCustomer.ViewMode;
// Enables Customer Fields while disabling shipping address fields.
begin
btnAdd.Enabled := true;
btnDelete.Enabled := true;
btnClose.Enabled := true;
btnSave.Enabled := false;
btnCancel.Enabled := false;
btnEdit.Enabled := true;
FViewMain.change := false;
btnShipAdd.Enabled := true;
if not xdwdsShipTo.IsEmpty then
begin
btnShipDelete.Enabled := true;
btnShipEdit.Enabled := true;
end
else
begin
btnShipDelete.Enabled := false;
btnShipEdit.Enabled := false;
end;
btnShipSave.Enabled := false;
btnShipCancel.Enabled := false;
edtName.Enabled := true;
edtShortName.Enabled := true;
edtBillAddress.Enabled := true;
edtBillCity.Enabled := true;
edtBillState.Enabled := true;
edtBillZip.Enabled := true;
edtBillContact.Enabled := true;
dtpStartDate.Enabled := true;
dtpEndDate.Enabled := true;
edtFax.Enabled := true;
edtPhone.Enabled := true;
wdblcbRep.Enabled := true;
lblFormState.Caption := 'View Mode';
lblFormState.ElementHandle.classList.remove('text-success');
lblFormState.ElementHandle.classList.add('text-danger');
end;
end. end.
\ No newline at end of file
...@@ -175,10 +175,10 @@ begin ...@@ -175,10 +175,10 @@ begin
Exit(''); Exit('');
Result := ''; Result := '';
asm asm
var Token = AToken.split('.'); const parts = AToken.split('.');
if (Token.length = 3) { if (parts.length === 3) { // <- strict compare
Result = Token[1]; // JWTs use url-safe base64; convert before atob
Result = atob(Result); Result = atob(parts[1].replace(/-/g,'+').replace(/_/g,'/'));
} }
end; end;
end; end;
......
...@@ -19,7 +19,7 @@ type ...@@ -19,7 +19,7 @@ type
FUnauthorizedAccessProc: TUnauthorizedAccessProc; FUnauthorizedAccessProc: TUnauthorizedAccessProc;
public public
const clientVersion = '0.9.4'; const clientVersion = '0.9.7';
procedure InitApp(SuccessProc: TSuccessProc; procedure InitApp(SuccessProc: TSuccessProc;
UnauthorizedAccessProc: TUnauthorizedAccessProc); UnauthorizedAccessProc: TUnauthorizedAccessProc);
procedure SetClientConfig(Callback: TVersionCheckCallback); procedure SetClientConfig(Callback: TVersionCheckCallback);
......
...@@ -3,15 +3,18 @@ unit Utils; ...@@ -3,15 +3,18 @@ unit Utils;
interface interface
uses uses
System.Classes, SysUtils, JS, Web, WEBLib.Forms, WEBLib.Toast, DateUtils; System.Classes, SysUtils, JS, Web, WEBLib.Forms, WEBLib.Toast, DateUtils, WebLib.Dialogs;
procedure ShowStatusMessage(const AMessage, AClass: string; const AElementId: string); procedure ShowStatusMessage(const AMessage, AClass: string; const AElementId: string);
procedure HideStatusMessage(const AElementId: string); procedure HideStatusMessage(const AElementId: string);
procedure ShowSpinner(SpinnerID: string); procedure ShowSpinner(SpinnerID: string);
procedure HideSpinner(SpinnerID: string); procedure HideSpinner(SpinnerID: string);
procedure ShowErrorModal(msg: string);
function CalculateAge(DateOfBirth: TDateTime): Integer; function CalculateAge(DateOfBirth: TDateTime): Integer;
function FormatPhoneNumber(PhoneNumber: string): string; function FormatPhoneNumber(PhoneNumber: string): string;
procedure ApplyReportTitle(CurrentReportType: string); procedure ApplyReportTitle(CurrentReportType: string);
procedure ShowToast(const MessageText: string; const ToastType: string = 'success');
procedure ShowConfirmationModal(msg, leftLabel, rightLabel: string; ConfirmProc: TProc<Boolean>);
// function FormatDollarValue(ValueStr: string): string; // function FormatDollarValue(ValueStr: string): string;
...@@ -65,6 +68,13 @@ begin ...@@ -65,6 +68,13 @@ begin
SpinnerElement := TJSHTMLElement(document.getElementById(SpinnerID)); SpinnerElement := TJSHTMLElement(document.getElementById(SpinnerID));
if Assigned(SpinnerElement) then if Assigned(SpinnerElement) then
begin begin
// Move spinner to the <body> if it's not already there
asm
if (SpinnerElement.parentNode !== document.body) {
document.body.appendChild(SpinnerElement);
}
end;
SpinnerElement.classList.remove('d-none'); SpinnerElement.classList.remove('d-none');
SpinnerElement.classList.add('d-block'); SpinnerElement.classList.add('d-block');
end; end;
...@@ -83,6 +93,85 @@ begin ...@@ -83,6 +93,85 @@ begin
end; end;
procedure ShowErrorModal(msg: string);
begin
asm
var modal = document.getElementById('main_errormodal');
var label = document.getElementById('main_lblmodal_body');
var reloadBtn = document.getElementById('btn_modal_restart');
if (label) label.innerText = msg;
// Ensure modal is a direct child of <body>
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
// Bind hard reload to button
if (reloadBtn) {
reloadBtn.onclick = function () {
window.location.reload(true); // hard reload, bypass cache
};
}
// Show the Bootstrap modal
var bsModal = new bootstrap.Modal(modal, { keyboard: false });
bsModal.show();
end;
end;
// ShowConfirmationModal displays a two-button modal with custom labels.
// Params:
// - messageText: text shown in the modal body
// - leftButtonText: label for the left button (e.g., "Cancel")
// - rightButtonText: label for the right button (e.g., "Delete")
// - callback: procedure(confirmed: Boolean); confirmed = True if right button clicked
//
// Example:
// ShowConfirmationModal('Delete this?', 'Cancel', 'Delete',
// procedure(confirmed: Boolean)
// begin
// if confirmed then DeleteOrder();
// end);
procedure ShowConfirmationModal(msg, leftLabel, rightLabel: string; ConfirmProc: TProc<Boolean>);
begin
asm
var modal = document.getElementById('main_confirmation_modal');
var body = document.getElementById('main_modal_body');
var btnLeft = document.getElementById('btn_confirm_left');
var btnRight = document.getElementById('btn_confirm_right');
var bsModal;
if (body) body.innerText = msg;
if (btnLeft) btnLeft.innerText = leftLabel;
if (btnRight) btnRight.innerText = rightLabel;
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
btnLeft.onclick = null;
btnRight.onclick = null;
btnLeft.onclick = function () {
bsModal.hide();
ConfirmProc(true); // user confirmed
};
btnRight.onclick = function () {
bsModal.hide();
ConfirmProc(false); // user canceled
};
bsModal = new bootstrap.Modal(modal, { keyboard: false });
bsModal.show();
end;
end;
function CalculateAge(DateOfBirth: TDateTime): Integer; function CalculateAge(DateOfBirth: TDateTime): Integer;
var var
Today, BirthDate: TJSDate; Today, BirthDate: TJSDate;
...@@ -126,6 +215,71 @@ begin ...@@ -126,6 +215,71 @@ begin
end; end;
procedure ShowToast(const MessageText: string; const ToastType: string = 'success');
var
ParsedText, ToastKind, MsgPrefix: string;
Parts: TArray<string>;
begin
ParsedText := MessageText.Trim;
ToastKind := ToastType.ToLower;
// Check for "Success:" or "Failure:" at the start of message
if ParsedText.Contains(':') then
begin
Parts := ParsedText.Split([':'], 2);
MsgPrefix := Parts[0].Trim.ToLower;
if (MsgPrefix = 'success') or (MsgPrefix = 'failure') then
begin
ParsedText := Parts[1].Trim;
if MsgPrefix = 'success' then
ToastKind := 'success'
else
ToastKind := 'danger';
end;
end;
asm
var toastEl = document.getElementById('bootstrapToast');
var toastBody = document.getElementById('bootstrapToastBody');
if (!toastEl || !toastBody) return;
toastBody.innerText = ParsedText;
toastEl.classList.remove('bg-success', 'bg-danger', 'bg-warning', 'bg-info');
toastEl.classList.remove('slide-in');
switch (ToastKind) {
case 'danger':
toastEl.classList.add('bg-danger');
break;
case 'warning':
toastEl.classList.add('bg-warning');
break;
case 'info':
toastEl.classList.add('bg-info');
break;
default:
toastEl.classList.add('bg-success');
}
// Add slide-in animation
toastEl.classList.add('slide-in');
var toast = new bootstrap.Toast(toastEl, { delay: 2500 });
toast.show();
// Remove animation class after it's done (so it can be reapplied)
setTimeout(function() {
toastEl.classList.remove('slide-in');
}, 500);
end;
end;
procedure ApplyReportTitle(CurrentReportType: string); procedure ApplyReportTitle(CurrentReportType: string);
var var
CrimeTitleElement: TJSHTMLElement; CrimeTitleElement: TJSHTMLElement;
......
object fViewAddItem: TfViewAddItem
Width = 640
Height = 480
OnCreate = WebFormCreate
OnShow = WebFormShow
object WebLabel1: TWebLabel
Left = 8
Top = 81
Width = 95
Height = 15
Caption = 'Search Customers'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 131
Top = 81
Width = 137
Height = 15
Caption = 'Selected Quickbooks Item'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtSearch: TWebEdit
Left = 4
Top = 102
Width = 121
Height = 22
ChildOrder = 2
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object TMSFNCGrid1: TTMSFNCGrid
Left = 0
Top = 163
Width = 640
Height = 317
Align = alBottom
ParentDoubleBuffered = False
DoubleBuffered = True
TabOrder = 1
DefaultRowHeight = 40.000000000000000000
FixedColumns = 0
ColumnCount = 4
Options.Bands.Enabled = True
Options.ColumnSize.Stretch = True
Options.Editing.CalcFormat = '%g'
Options.Grouping.CalcFormat = '%g'
Options.Grouping.GroupCountFormat = '(%d)'
Options.IO.XMLEncoding = 'ISO-8859-1'
Options.Mouse.ClickMargin = 0
Options.Mouse.ColumnSizeMargin = 6
Options.Mouse.RowSizeMargin = 6
Columns = <
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 90.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 150.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 200.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 181.000000000000000000
end
item
BorderWidth = 1
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 4539717
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
Font.Charset = DEFAULT_CHARSET
Font.Color = 8026746
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
ID = ''
Width = 90.000000000000000000
end>
DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText
DefaultFont.Height = -11
DefaultFont.Name = 'Segoe UI'
DefaultFont.Style = []
TopRow = 1
Appearance.FixedLayout.Fill.Color = 16380654
Appearance.FixedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedLayout.Font.Color = 4539717
Appearance.FixedLayout.Font.Height = -13
Appearance.FixedLayout.Font.Name = 'Segoe UI'
Appearance.FixedLayout.Font.Style = [fsBold]
Appearance.NormalLayout.Fill.Color = 16578806
Appearance.NormalLayout.Font.Charset = DEFAULT_CHARSET
Appearance.NormalLayout.Font.Color = 8026746
Appearance.NormalLayout.Font.Height = -11
Appearance.NormalLayout.Font.Name = 'Segoe UI'
Appearance.NormalLayout.Font.Style = []
Appearance.GroupLayout.Fill.Color = 12817262
Appearance.GroupLayout.Font.Charset = DEFAULT_CHARSET
Appearance.GroupLayout.Font.Color = clBlack
Appearance.GroupLayout.Font.Height = -11
Appearance.GroupLayout.Font.Name = 'Segoe UI'
Appearance.GroupLayout.Font.Style = []
Appearance.SummaryLayout.Fill.Color = 14009785
Appearance.SummaryLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SummaryLayout.Font.Color = clBlack
Appearance.SummaryLayout.Font.Height = -11
Appearance.SummaryLayout.Font.Name = 'Segoe UI'
Appearance.SummaryLayout.Font.Style = []
Appearance.SelectedLayout.Fill.Color = 16441019
Appearance.SelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.SelectedLayout.Font.Color = 4539717
Appearance.SelectedLayout.Font.Height = -11
Appearance.SelectedLayout.Font.Name = 'Segoe UI'
Appearance.SelectedLayout.Font.Style = []
Appearance.FocusedLayout.Fill.Color = 16039284
Appearance.FocusedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FocusedLayout.Font.Color = 4539717
Appearance.FocusedLayout.Font.Height = -11
Appearance.FocusedLayout.Font.Name = 'Segoe UI'
Appearance.FocusedLayout.Font.Style = []
Appearance.FixedSelectedLayout.Fill.Color = clLightsteelblue
Appearance.FixedSelectedLayout.Font.Charset = DEFAULT_CHARSET
Appearance.FixedSelectedLayout.Font.Color = clBlack
Appearance.FixedSelectedLayout.Font.Height = -11
Appearance.FixedSelectedLayout.Font.Name = 'Segoe UI'
Appearance.FixedSelectedLayout.Font.Style = []
Appearance.BandLayout.Fill.Color = 16711679
Appearance.BandLayout.Font.Charset = DEFAULT_CHARSET
Appearance.BandLayout.Font.Color = 8026746
Appearance.BandLayout.Font.Height = -11
Appearance.BandLayout.Font.Name = 'Segoe UI'
Appearance.BandLayout.Font.Style = []
Appearance.ProgressLayout.Format = '%.0f%%'
LeftCol = 0
ScrollMode = scmItemScrolling
DesignTimeSampleData = True
OnCellClick = TMSFNCGrid1CellClick
end
object btnCancel: TWebButton
Left = 544
Top = 101
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object btnConfirm: TWebButton
Left = 446
Top = 101
Width = 96
Height = 25
Caption = 'Select'
ChildOrder = 5
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object edtNotification: TWebEdit
Left = 4
Top = 16
Width = 510
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clRed
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtName: TWebEdit
Left = 131
Top = 102
Width = 142
Height = 22
ChildOrder = 1
Enabled = False
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 612
Top = 47
end
object xdwdsCustomers: TXDataWebDataSet
Connection = DMConnection.ApiConnection
Left = 166
Top = 129
object xdwdsCustomersqb_items_id: TStringField
FieldName = 'qb_items_id'
end
object xdwdsCustomersqb_item_name: TStringField
FieldName = 'qb_item_name'
end
object xdwdsCustomersitem_desc: TStringField
FieldName = 'item_desc'
end
object xdwdsCustomersstatus: TStringField
FieldName = 'status'
end
object xdwdsCustomersqb_items_qb_id: TStringField
FieldName = 'qb_items_qb_id'
end
end
object wdsCustomers: TWebDataSource
DataSet = xdwdsCustomers
Left = 104
Top = 135
end
end
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>TMS Web Project</title>
<style>
</style>
</head>
<body>
</body>
</html>
\ No newline at end of file
unit View.AddItem;
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, VCL.TMSFNCTypes, VCL.TMSFNCUtils,
VCL.TMSFNCGraphics, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCGridCell,
VCL.TMSFNCGridOptions, VCL.TMSFNCCustomControl, VCL.TMSFNCCustomScrollControl,
VCL.TMSFNCGridData, VCL.TMSFNCCustomGrid, VCL.TMSFNCGrid, Utils;
type
TfViewAddItem = class(TWebForm)
WebLabel1: TWebLabel;
WebLabel3: TWebLabel;
edtSearch: TWebEdit;
TMSFNCGrid1: TTMSFNCGrid;
btnCancel: TWebButton;
btnConfirm: TWebButton;
edtNotification: TWebEdit;
edtName: TWebEdit;
XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet;
wdsCustomers: TWebDataSource;
xdwdsCustomersqb_items_id: TStringField;
xdwdsCustomersqb_item_name: TStringField;
xdwdsCustomersitem_desc: TStringField;
xdwdsCustomersstatus: TStringField;
xdwdsCustomersqb_items_qb_id: TStringField;
procedure WebFormCreate(Sender: TObject);
procedure WebFormShow(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
private
{ Private declarations }
[async] procedure getItems();
procedure PopulateGridManually();
[async] procedure SendItemToServer();
public
{ Public declarations }
notification: string;
end;
var
fViewAddItem: TfViewAddItem;
implementation
{$R *.dfm}
procedure TfViewAddItem.WebFormCreate(Sender: TObject);
begin
if not DMConnection.ApiConnection.Connected then
begin
DMConnection.ApiConnection.OpenAsync;
console.log('report requirements connection open')
end;
end;
procedure TfViewAddItem.WebFormShow(Sender: TObject);
begin
//Utils.ShowSpinner('spinner');
getItems();
end;
procedure TfViewAddItem.btnCancelClick(Sender: TObject);
begin
close();
end;
procedure TfViewAddItem.btnConfirmClick(Sender: TObject);
begin
xdwdsCustomers.Locate('qb_item_name', edtName.Text, []);
if edtName.Text = '' then
edtNotification.Text := 'Please Select an Item'
else if xdwdsCustomers.FieldByName('qb_items_id').AsString <> '' then
edtNotification.Text := 'Item Already In Database'
else
SendItemToServer();
end;
procedure TfViewAddItem.getItems;
var
xdcResponse: TXDataClientResponse;
customerList: TJSObject;
i: integer;
begin
// Fetch data from XData service
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.getQBItems', []));
customerList := TJSObject(xdcResponse.Result);
// Load data into TXDataWebDataset
xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList);
xdwdsCustomers.Open;
// Manually populate the grid
PopulateGridManually;
//Utils.HideSpinner('spinner');
end;
procedure TFViewAddItem.PopulateGridManually;
// populates the grid with customers manually.
var
RowIndex: Integer;
begin
TMSFNCGrid1.BeginUpdate;
try
TMSFNCGrid1.Clear; // Clear any existing data
// Set up column headers
TMSFNCGrid1.ColumnCount := 4;
TMSFNCGrid1.RowCount := 1;
TMSFNCGrid1.Cells[0, 0] := 'KGOrders ID';
TMSFNCGrid1.Cells[1, 0] := 'Item Name';
TMSFNCGrid1.Cells[2, 0] := 'Item Description';
TMSFNCGrid1.Cells[3, 0] := 'Status';
// Populate the grid with data from the dataset
xdwdsCustomers.First;
RowIndex := 1;
while not xdwdsCustomers.EOF do
begin
TMSFNCGrid1.RowCount := RowIndex + 1;
TMSFNCGrid1.Cells[0, RowIndex] := xdwdsCustomers.FieldByName('qb_items_id').AsString;
TMSFNCGrid1.Cells[1, RowIndex] := xdwdsCustomers.FieldByName('qb_item_name').AsString;
TMSFNCGrid1.Cells[2, RowIndex] := xdwdsCustomers.FieldByName('item_desc').AsString;
TMSFNCGrid1.Cells[3, RowIndex] := xdwdsCustomers.FieldByName('status').AsString;
Inc(RowIndex);
xdwdsCustomers.Next;
end;
finally
TMSFNCGrid1.EndUpdate;
end;
Utils.HideSpinner('spinner');
end;
procedure TfViewAddItem.TMSFNCGrid1CellClick(Sender: TObject; ACol,
ARow: Integer);
begin
edtName.Text := TMSFNCGrid1.Cells[1, ARow];
end;
procedure TFViewAddItem.SendItemToServer;
var
ItemJSON: TJSONObject;
Response: TXDataClientResponse;
jsObj: TJSObject;
begin
ItemJSON := TJSONObject.Create;
ItemJSON.AddPair('qb_item_name', xdwdsCustomers.FieldByName('qb_item_name').AsString);
ItemJSON.AddPair('item_desc', xdwdsCustomers.FieldByName('item_desc').AsString);
ItemJSON.AddPair('status', xdwdsCustomers.FieldByName('status').AsString);
ItemJSON.AddPair('qb_items_qb_id', xdwdsCustomers.FieldByName('qb_items_qb_id').AsString);
ItemJSON.AddPair('mode', 'ADD');
// Utils.ShowSpinner('spinner');
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddItem',
[ItemJSON.ToString]));
jsObj := TJSObject(Response.Result);
notification := string(jsObj['msg']);
// Utils.HideSpinner('spinner');
Close();
end;
end.
\ No newline at end of file
object FAddOrder: TFAddOrder object FAddOrder: TFAddOrder
Width = 871 Width = 871
Height = 477 Height = 428
OnShow = WebFormShow OnShow = WebFormShow
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 4 Left = 4
Top = 81 Top = 49
Width = 95 Width = 95
Height = 15 Height = 15
Caption = 'Search Customers' Caption = 'Search Customers'
...@@ -13,7 +13,7 @@ object FAddOrder: TFAddOrder ...@@ -13,7 +13,7 @@ object FAddOrder: TFAddOrder
end end
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 135 Left = 135
Top = 81 Top = 49
Width = 113 Width = 113
Height = 15 Height = 15
Caption = 'Selected Customer ID' Caption = 'Selected Customer ID'
...@@ -22,7 +22,7 @@ object FAddOrder: TFAddOrder ...@@ -22,7 +22,7 @@ object FAddOrder: TFAddOrder
end end
object WebLabel3: TWebLabel object WebLabel3: TWebLabel
Left = 283 Left = 283
Top = 81 Top = 49
Width = 134 Width = 134
Height = 15 Height = 15
Caption = 'Selected Customer Name' Caption = 'Selected Customer Name'
...@@ -31,7 +31,7 @@ object FAddOrder: TFAddOrder ...@@ -31,7 +31,7 @@ object FAddOrder: TFAddOrder
end end
object edtSearch: TWebEdit object edtSearch: TWebEdit
Left = 4 Left = 4
Top = 102 Top = 70
Width = 121 Width = 121
Height = 22 Height = 22
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
...@@ -40,7 +40,7 @@ object FAddOrder: TFAddOrder ...@@ -40,7 +40,7 @@ object FAddOrder: TFAddOrder
end end
object edtID: TWebEdit object edtID: TWebEdit
Left = 135 Left = 135
Top = 102 Top = 70
Width = 142 Width = 142
Height = 22 Height = 22
ChildOrder = 1 ChildOrder = 1
...@@ -50,7 +50,7 @@ object FAddOrder: TFAddOrder ...@@ -50,7 +50,7 @@ object FAddOrder: TFAddOrder
end end
object TMSFNCGrid1: TTMSFNCGrid object TMSFNCGrid1: TTMSFNCGrid
Left = 0 Left = 0
Top = 160 Top = 111
Width = 871 Width = 871
Height = 317 Height = 317
Align = alBottom Align = alBottom
...@@ -204,10 +204,11 @@ object FAddOrder: TFAddOrder ...@@ -204,10 +204,11 @@ object FAddOrder: TFAddOrder
ScrollMode = scmItemScrolling ScrollMode = scmItemScrolling
DesignTimeSampleData = True DesignTimeSampleData = True
OnCellClick = TMSFNCGrid1CellClick OnCellClick = TMSFNCGrid1CellClick
ExplicitTop = 112
end end
object cbCorrugatedPlate: TWebCheckBox object cbCorrugatedPlate: TWebCheckBox
Left = 4 Left = 4
Top = 49 Top = 17
Width = 113 Width = 113
Height = 22 Height = 22
Caption = 'Corrugated Plate' Caption = 'Corrugated Plate'
...@@ -219,7 +220,7 @@ object FAddOrder: TFAddOrder ...@@ -219,7 +220,7 @@ object FAddOrder: TFAddOrder
end end
object cbWebPlate: TWebCheckBox object cbWebPlate: TWebCheckBox
Left = 134 Left = 134
Top = 49 Top = 17
Width = 83 Width = 83
Height = 22 Height = 22
Caption = 'Web Plate' Caption = 'Web Plate'
...@@ -230,7 +231,7 @@ object FAddOrder: TFAddOrder ...@@ -230,7 +231,7 @@ object FAddOrder: TFAddOrder
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 542 Left = 542
Top = 101 Top = 69
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
...@@ -241,7 +242,7 @@ object FAddOrder: TFAddOrder ...@@ -241,7 +242,7 @@ object FAddOrder: TFAddOrder
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 436 Left = 436
Top = 101 Top = 69
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Select' Caption = 'Select'
...@@ -252,7 +253,7 @@ object FAddOrder: TFAddOrder ...@@ -252,7 +253,7 @@ object FAddOrder: TFAddOrder
end end
object cbCuttingDie: TWebCheckBox object cbCuttingDie: TWebCheckBox
Left = 239 Left = 239
Top = 49 Top = 17
Width = 83 Width = 83
Height = 22 Height = 22
Caption = 'Cutting Die' Caption = 'Cutting Die'
...@@ -261,30 +262,9 @@ object FAddOrder: TFAddOrder ...@@ -261,30 +262,9 @@ object FAddOrder: TFAddOrder
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = cbCuttingDieClick OnClick = cbCuttingDieClick
end end
object edtNotification: TWebEdit
Left = 4
Top = 16
Width = 510
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clRed
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtName: TWebEdit object edtName: TWebEdit
Left = 283 Left = 283
Top = 102 Top = 70
Width = 142 Width = 142
Height = 22 Height = 22
ChildOrder = 1 ChildOrder = 1
......
<html> <div id="spinner" class="position-absolute top-50 start-50 translate-middle d-none">
<head> <div class="lds-roller">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <div></div><div></div><div></div><div></div>
<title>TMS Web Project</title> <div></div><div></div><div></div><div></div>
<style> </div>
</style> </div>
</head>
<body>
</body>
</html>
\ No newline at end of file
...@@ -11,7 +11,7 @@ uses ...@@ -11,7 +11,7 @@ uses
VCL.TMSFNCGridOptions, Vcl.Controls, VCL.TMSFNCCustomControl, VCL.TMSFNCGridOptions, Vcl.Controls, VCL.TMSFNCCustomControl,
VCL.TMSFNCCustomScrollControl, VCL.TMSFNCGridData, VCL.TMSFNCCustomGrid, VCL.TMSFNCCustomScrollControl, VCL.TMSFNCGridData, VCL.TMSFNCCustomGrid,
VCL.TMSFNCGrid, Vcl.StdCtrls, WEBLib.StdCtrls, XData.Web.Client, Data.DB, VCL.TMSFNCGrid, Vcl.StdCtrls, WEBLib.StdCtrls, XData.Web.Client, Data.DB,
XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, ConnectionModule; XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, ConnectionModule, Utils;
type type
TFAddOrder = class(TWebForm) TFAddOrder = class(TWebForm)
...@@ -30,7 +30,6 @@ type ...@@ -30,7 +30,6 @@ type
xdwdsCustomersSHORT_NAME: TStringField; xdwdsCustomersSHORT_NAME: TStringField;
wdsCustomers: TWebDataSource; wdsCustomers: TWebDataSource;
cbCuttingDie: TWebCheckBox; cbCuttingDie: TWebCheckBox;
edtNotification: TWebEdit;
xdwdsCustomersstaff_fields_invoice_to: TStringField; xdwdsCustomersstaff_fields_invoice_to: TStringField;
xdwdsCustomersCUSTOMER_ID: TIntegerField; xdwdsCustomersCUSTOMER_ID: TIntegerField;
WebLabel3: TWebLabel; WebLabel3: TWebLabel;
...@@ -67,25 +66,25 @@ begin ...@@ -67,25 +66,25 @@ begin
Close; Close;
end; end;
procedure TFAddOrder.btnConfirmClick(Sender: TObject); procedure TFAddOrder.btnConfirmClick(Sender: TObject);
begin begin
confirm := true; confirm := true;
edtNotification.ElementHandle.style.setProperty('color', '#8B0000', 'important');
if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) ) then if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) ) then
begin begin
edtNotification.Text := 'Please Select an Order Type'; ShowToast('Please Select an Order Type', 'danger');
confirm := false; confirm := false;
end; end;
if edtID.Text = '' then if edtID.Text = '' then
begin begin
edtNotification.Text := 'Please Select a Customer'; ShowToast('Please Select a Customer', 'danger');
confirm := false; confirm := false;
end; end;
if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) and (edtID.Text = '' )) then if ( ( not cbCorrugatedPlate.Checked ) and ( not cbWebPlate.Checked ) and ( not cbCuttingDie.Checked ) and (edtID.Text = '' )) then
begin begin
edtNotification.Text := 'Please Select an Order Type and a Customer'; ShowToast('Please Select an Order Type and a Customer', 'danger');
confirm := false; confirm := false;
end; end;
...@@ -95,6 +94,7 @@ begin ...@@ -95,6 +94,7 @@ begin
end; end;
end; end;
procedure TFAddOrder.WebFormShow(Sender: TObject); procedure TFAddOrder.WebFormShow(Sender: TObject);
begin begin
confirm := false; confirm := false;
...@@ -108,23 +108,27 @@ begin ...@@ -108,23 +108,27 @@ begin
cbCuttingDie.Checked := False; cbCuttingDie.Checked := False;
end; end;
procedure TFAddOrder.cbCuttingDieClick(Sender: TObject); procedure TFAddOrder.cbCuttingDieClick(Sender: TObject);
begin begin
cbCorrugatedPlate.Checked := False; cbCorrugatedPlate.Checked := False;
cbWebPlate.Checked := False; cbWebPlate.Checked := False;
end; end;
procedure TFAddOrder.cbWebPlateClick(Sender: TObject); procedure TFAddOrder.cbWebPlateClick(Sender: TObject);
begin begin
cbCorrugatedPlate.Checked := False; cbCorrugatedPlate.Checked := False;
cbCuttingDie.Checked := False; cbCuttingDie.Checked := False;
end; end;
procedure TFAddOrder.edtSearchChange(Sender: TObject); procedure TFAddOrder.edtSearchChange(Sender: TObject);
begin begin
ApplyFilter; ApplyFilter;
end; end;
[async] procedure TFAddOrder.getCustomers(); [async] procedure TFAddOrder.getCustomers();
// retrieves customer list from server // retrieves customer list from server
var var
...@@ -144,6 +148,7 @@ begin ...@@ -144,6 +148,7 @@ begin
PopulateGridManually; PopulateGridManually;
end; end;
procedure TFAddOrder.PopulateGridManually; procedure TFAddOrder.PopulateGridManually;
// populates the grid with customers manually. // populates the grid with customers manually.
var var
...@@ -191,6 +196,7 @@ begin ...@@ -191,6 +196,7 @@ begin
DBID := TMSFNCGrid1.Cells[0, ARow]; DBID := TMSFNCGrid1.Cells[0, ARow];
end; end;
procedure TFAddOrder.ApplyFilter; procedure TFAddOrder.ApplyFilter;
// filters the grid based on search textbox contents. // filters the grid based on search textbox contents.
var var
......
object FViewCustomers: TFViewCustomers object FViewCustomers: TFViewCustomers
Width = 640 Width = 640
Height = 480 Height = 480
CSSLibrary = cssBootstrap
ElementFont = efCSS
OnCreate = WebFormCreate OnCreate = WebFormCreate
object lblEntries: TWebLabel object lblEntries: TWebLabel
Left = 12 Left = 12
...@@ -42,6 +44,7 @@ object FViewCustomers: TFViewCustomers ...@@ -42,6 +44,7 @@ object FViewCustomers: TFViewCustomers
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Text = '500' Text = '500'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = wcbPageSizeChange
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
'100' '100'
......
<div class="container h-100 d-flex flex-column mt-0" style="max-width: 100%; padding-bottom: 0;"> <div class="container h-100 d-flex flex-column mt-0" style="max-width: 100%; padding-bottom: 0;">
<!-- Alert Section -->
<div class="row">
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div>
</div>
<!-- Actions Row --> <!-- Actions Row -->
<div class="row mt-3 justify-content-center align-items-end"> <div class="row mt-3 justify-content-center align-items-end">
<div class="col-auto"> <div class="col-auto">
......
...@@ -13,7 +13,7 @@ uses ...@@ -13,7 +13,7 @@ uses
WEBLib.Grids, VCL.TMSFNCTypes, VCL.TMSFNCUtils, VCL.TMSFNCGraphics, WEBLib.Grids, VCL.TMSFNCTypes, VCL.TMSFNCUtils, VCL.TMSFNCGraphics,
VCL.TMSFNCGraphicsTypes, VCL.TMSFNCGridCell, VCL.TMSFNCGridOptions, VCL.TMSFNCGraphicsTypes, VCL.TMSFNCGridCell, VCL.TMSFNCGridOptions,
VCL.TMSFNCCustomControl, VCL.TMSFNCCustomScrollControl, VCL.TMSFNCGridData, VCL.TMSFNCCustomControl, VCL.TMSFNCCustomScrollControl, VCL.TMSFNCGridData,
VCL.TMSFNCCustomGrid, VCL.TMSFNCGrid; VCL.TMSFNCCustomGrid, VCL.TMSFNCGrid, VCL.Forms;
type type
TFViewCustomers = class(TWebForm) TFViewCustomers = class(TWebForm)
...@@ -36,13 +36,13 @@ type ...@@ -36,13 +36,13 @@ type
procedure btnAddCustomerClick(Sender: TObject); procedure btnAddCustomerClick(Sender: TObject);
procedure wdbtcCustomersDblClickCell(Sender: TObject; ACol, ARow: Integer); procedure wdbtcCustomersDblClickCell(Sender: TObject; ACol, ARow: Integer);
procedure edtFilterChange(Sender: TObject); procedure edtFilterChange(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject);
private private
{ Private declarations } { Private declarations }
procedure GeneratePagination(TotalPages: Integer); procedure GeneratePagination(TotalPages: Integer);
[async] procedure GetCustomers(searchOptions: string); [async] procedure GetCustomers(searchOptions: string);
function GenerateSearchOptions(): string; function GenerateSearchOptions(): string;
procedure HideNotification(); procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure ShowSelectCustomerForm(); procedure ShowSelectCustomerForm();
var var
...@@ -75,6 +75,7 @@ begin ...@@ -75,6 +75,7 @@ begin
newform.Caption := 'Select Customer and Order Type'; newform.Caption := 'Select Customer and Order Type';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
window.location.hash := 'subform'; window.location.hash := 'subform';
...@@ -125,39 +126,32 @@ begin ...@@ -125,39 +126,32 @@ begin
if PageNumber > 0 then if PageNumber > 0 then
begin begin
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomers', [searchOptions])); try
customerList := TJSObject(xdcResponse.Result); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomers', [searchOptions]));
customerList := TJSObject(xdcResponse.Result);
// Load data into the dataset
xdwdsCustomers.Close; xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList['data']); xdwdsCustomers.SetJsonData(customerList['data']);
xdwdsCustomers.Open; xdwdsCustomers.Open;
Utils.HideSpinner('spinner'); customerListLength := integer(customerList['count']);
TotalPages := ( (customerListLength + PageSize - 1) div PageSize);
customerListLength := integer(customerList['count']);
TotalPages := ( (customerListLength + PageSize - 1) div PageSize); if customerListLength = 0 then
lblEntries.Caption := 'No entries found'
if customerListLength = 0 then else if (PageNumber * PageSize) < customerListLength then
begin lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
lblEntries.Caption := 'No entries found'; ' - ' + IntToStr(customerListLength) +
end ' of ' + IntToStr(customerListLength)
else if (PageNumber * PageSize) < customerListLength then else
// Currently these do the same thing. If you want to limit the number of entries lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
// You will need to edit the server side, and then change this if statement so the label ' - ' + IntToStr(customerListLength) +
// Correctly displayes. I believe it is IntToStr(PageSize * PageNum) ' of ' + IntToStr(customerListLength);
begin except
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + on E: EXDataClientRequestException do
' - ' + IntToStr(customerListLength) + Utils.ShowErrorModal('Could not retrieve customers: ' + E.ErrorResult.ErrorMessage);
' of ' + IntToStr(customerListLength);
end
else if (PageNumber * PageSize) >= customerListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(customerListLength) +
' of ' + IntToStr(customerListLength);
end; end;
Utils.HideSpinner('spinner');
end; end;
end; end;
...@@ -180,34 +174,13 @@ begin ...@@ -180,34 +174,13 @@ begin
end; end;
procedure TFViewCustomers.ShowNotification(Notification: string); procedure TFViewCustomers.wcbPageSizeChange(Sender: TObject);
var
splitNotification: TArray<string>;
begin begin
if Notification <> '' then PageSize := StrToInt(wcbPageSize.Text);
begin getCustomers(GenerateSearchOptions());
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end; end;
procedure TFViewCustomers.wdbtcCustomersDblClickCell(Sender: TObject; ACol, procedure TFViewCustomers.wdbtcCustomersDblClickCell(Sender: TObject; ACol,
ARow: Integer); ARow: Integer);
begin begin
......
...@@ -108,6 +108,7 @@ object FViewEditUser: TFViewEditUser ...@@ -108,6 +108,7 @@ object FViewEditUser: TFViewEditUser
ElementID = 'edtconfirmpassword' ElementID = 'edtconfirmpassword'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtConfirmPasswordChange
end end
object edtEmail: TWebEdit object edtEmail: TWebEdit
Left = 96 Left = 96
...@@ -128,6 +129,7 @@ object FViewEditUser: TFViewEditUser ...@@ -128,6 +129,7 @@ object FViewEditUser: TFViewEditUser
ElementID = 'edtpassword' ElementID = 'edtpassword'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtPasswordChange
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 96 Left = 96
...@@ -187,48 +189,6 @@ object FViewEditUser: TFViewEditUser ...@@ -187,48 +189,6 @@ object FViewEditUser: TFViewEditUser
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick OnClick = btnCancelClick
end end
object btnConfirmChanges: TWebButton
Left = 100
Top = 330
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 16
ElementID = 'btn_confirm_changes'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmChangesClick
end
object pnlMessage: TWebPanel
Left = 482
Top = 4
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder = 8
object lblMessage: TWebLabel
Left = 16
Top = 11
Width = 46
Height = 15
Caption = 'Message'
ElementID = 'view.login.message.label'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object cbStatus: TWebCheckBox object cbStatus: TWebCheckBox
Left = 96 Left = 96
Top = 162 Top = 162
......
<div class="row"> <div class="container">
<div class="col-12">
<div class="container mt-4"> <!-- Edit-User form -->
<div class="row justify-content-center"> <div class="row">
<div class="col-12 col-md-8"> <div class="col-lg-10 col-xl-8 mx-auto">
<div class="row"> <form id="edituserform" class="row g-3 needs-validation" novalidate>
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger"> <div class="col-md-6">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button> <label id="lblfullname" for="edtfullname" class="form-label">Full&nbsp;Name</label>
<span id="view.login.message.label"></span> <input id="edtfullname" class="form-control" required>
</div> <div class="invalid-feedback">Full Name is required.</div>
</div>
</div>
<form class="form-inline">
<div class="row">
<div class="col-sm">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px;"id="lblfullname">Full Name:</label>
<input id="edtfullname" class= "form-control input-sm" width='50%'/>
</div>
<div class="col-sm">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lblusername">Username:</label>
<input id="edtusername" class="form-control input-sm" width='50%'>
</div>
</div>
</form>
<form class="form-inline">
<div class="row">
<div class="col-sm">
<label class='pe-2' style="font-weight: 700;font-size: 15px;"id="lblpassword">Password:</label>
<input id="edtpassword" class= "form-control input-sm" width='50%'/>
</div>
<div class="col-sm">
<label class= 'pe-2' style="font-weight: 700;font-size: 15px"id="lblconfirm">Confirm Password:</label>
<input class="form-control input-sm" id="edtconfirmpassword">
</div>
</div>
</form>
<form class="form-inline">
<div class="row">
<div class="col-sm">
<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="lblQB">Quickbook ID:</label>
<input class="form-control input-sm" id="edtQB">
</div>
</div>
</form>
<div class="row">
<div class="col-6">
<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>
<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="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 class="col-sm-12 py-2">
<button class="py-2" id="btnconfirm" style="font-weight: 700;font-size: 15px";>Confirm</button>
<button class="py-2" id="btncancel" style="font-weight: 700;font-size: 15px";>Cancel</button>
</div>
</div>
</div>
</div>
</div> </div>
<div class="col-md-6">
<label id="lblusername" for="edtusername" class="form-label">Username</label>
<input id="edtusername" class="form-control" required>
<div class="invalid-feedback">Username is required.</div>
</div>
<div class="col-md-6">
<label id="lblpassword" for="edtpassword" class="form-label">Password</label>
<input id="edtpassword" type="password" class="form-control" required>
<div class="invalid-feedback">Passwords must match.</div>
</div>
<div class="col-md-6">
<label id="lblconfirm" for="edtconfirmpassword" class="form-label">Confirm&nbsp;Password</label>
<input id="edtconfirmpassword" type="password" class="form-control" required disabled>
<div class="invalid-feedback">Passwords must match.</div>
</div>
<div class="col-md-6">
<label id="lblemail" for="edtemail" class="form-label">Email&nbsp;Address</label>
<input id="edtemail" type="email" class="form-control" required>
<div class="invalid-feedback">Valid email is required.</div>
</div>
<div class="col-md-6">
<label id="lblQB" for="edtQB" class="form-label">QuickBooks&nbsp;ID</label>
<input id="edtQB" class="form-control">
</div>
<div class="col-md-6">
<label id="lblrights" for="edtrights" class="form-label">System&nbsp;Rights</label>
<input id="edtrights" class="form-control">
</div>
<div class="col-md-6">
<label id="lblaccess" for="cbaccess" class="form-label">Access&nbsp;Type</label>
<select id="cbaccess" class="form-select" required>
<option selected disabled value="">Choose...</option>
<option value="ALL">All</option>
<option value="LIMITED">Limited</option>
</select>
<div class="invalid-feedback">Please select an access type.</div>
</div>
<div class="col-md-6">
<div class="form-check pt-2">
<input id="cbstatus" class="form-check-input" type="checkbox">
<label id="lblactive" for="cbstatus" class="form-check-label">Active</label>
</div>
</div>
<div class="d-flex gap-2 mt-4">
<button id="btnconfirm" type="button" class="btn btn-primary flex-grow-1">
Confirm
</button>
<button id="btncancel" type="button" class="btn btn-outline-secondary flex-grow-1">
Cancel
</button>
</div>
</form>
</div> </div>
</div>
</div> </div>
<!-- Confirmation modal -->
<div class="modal fade" id="confirmation_modal" tabindex="-1" aria-labelledby="confirmation_modal_label" aria-hidden="true"> <div class="modal fade" id="confirmation_modal" tabindex="-1" aria-labelledby="confirmation_modal_label" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
...@@ -95,3 +94,4 @@ ...@@ -95,3 +94,4 @@
</div> </div>
</div> </div>
</div> </div>
...@@ -26,10 +26,6 @@ type ...@@ -26,10 +26,6 @@ type
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
btnCancel: TWebButton; btnCancel: TWebButton;
WebTimer1: TWebTimer; WebTimer1: TWebTimer;
btnConfirmChanges: TWebButton;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
lblactive: TWebLabel; lblactive: TWebLabel;
cbStatus: TWebCheckBox; cbStatus: TWebCheckBox;
lblRights: TWebLabel; lblRights: TWebLabel;
...@@ -42,8 +38,8 @@ type ...@@ -42,8 +38,8 @@ type
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure WebTimer1Timer(Sender: TObject); procedure WebTimer1Timer(Sender: TObject);
procedure btnConfirmChangesClick(Sender: TObject); procedure edtPasswordChange(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject); procedure edtConfirmPasswordChange(Sender: TObject);
private private
{ Private declarations } { Private declarations }
FMessage: string; FMessage: string;
...@@ -59,8 +55,7 @@ type ...@@ -59,8 +55,7 @@ type
QB: string; QB: string;
[async] procedure EditUser(); [async] procedure EditUser();
[async] function AddUser(): string; [async] function AddUser(): string;
procedure HideNotification(); procedure ValidatePasswords;
procedure ShowNotification(notification: string);
public public
{ Public declarations } { Public declarations }
Info: string; Info: string;
...@@ -84,26 +79,12 @@ Utils; ...@@ -84,26 +79,12 @@ Utils;
procedure TFViewEditUser.btnCancelClick(Sender: TObject); procedure TFViewEditUser.btnCancelClick(Sender: TObject);
// Cancels the edit or addition // Cancels the edit or addition
begin begin
Info := 'Failure:Changes discarded!'; Info := 'Failure: Changes discarded!';
FViewMain.ShowUserForm(Info); FViewMain.ShowUserForm(Info);
end; end;
procedure TFViewEditUser.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
procedure TFViewEditUSer.btnConfirmChangesClick(Sender: TObject);
begin
if Mode = 'Edit' then
EditUser()
else
AddUser();
WebTimer1.Enabled := true;
Utils.ShowSpinner('spinner');
end;
function TFViewEditUser.AddUser(): string; function TFViewEditUser.AddUser: string;
// Sends UserInfo over to the server so it can be added to the database // Sends UserInfo over to the server so it can be added to the database
var var
userInfo: string; userInfo: string;
...@@ -111,35 +92,26 @@ var ...@@ -111,35 +92,26 @@ var
responseString: TJSObject; responseString: TJSObject;
begin begin
userInfo := '&username=' + edtUsername.Text + userInfo := '&username=' + edtUsername.Text +
'&fullname=' + edtFullName.Text + '&fullname=' + edtFullName.Text +
'&password=' + edtPassword.Text + '&password=' + edtPassword.Text +
'&status=' + BoolToStr(cbStatus.Checked) + '&status=' + BoolToStr(cbStatus.Checked) +
'&email=' + edtEmail.Text + '&email=' + edtEmail.Text +
'&access=' + cbAccess.Text + '&access=' + cbAccess.Text +
'&newuser=' + edtUsername.Text + '&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text + '&rights=' + edtRights.Text +
'&QB=' + edtQB.Text; '&QB=' + edtQB.Text;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', try
[userInfo])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', [userInfo]));
responseString := TJSObject(xdcResponse.Result); responseString := TJSObject(xdcResponse.Result);
Info := string(responseString['value']); Info := string(responseString['value']);
end; except
on E: EXDataClientRequestException do
procedure TFViewEditUser.HideNotification; Utils.ShowErrorModal('Could not add user: ' + E.ErrorResult.ErrorMessage);
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFViewEditUser.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
lblMessage.Caption := Notification;
pnlMessage.ElementHandle.hidden := False;
end; end;
end; end;
procedure TFViewEditUser.EditUser(); procedure TFViewEditUser.EditUser();
// Sends EditOptions over to the server so the given user can be editted // Sends EditOptions over to the server so the given user can be editted
var var
...@@ -167,6 +139,16 @@ begin ...@@ -167,6 +139,16 @@ begin
end; end;
procedure TFViewEditUser.edtConfirmPasswordChange(Sender: TObject);
begin
ValidatePasswords;
end;
procedure TFViewEditUser.edtPasswordChange(Sender: TObject);
begin
ValidatePasswords;
end;
class function TFViewEditUser.CreateForm(AElementID, Mode, Username, Password, Name, Status, Email, class function TFViewEditUser.CreateForm(AElementID, Mode, Username, Password, Name, Status, Email,
Access, Rights, Perspective, QB: string): TWebForm; Access, Rights, Perspective, QB: string): TWebForm;
// Autofills known information about a user on create // Autofills known information about a user on create
...@@ -194,9 +176,7 @@ procedure TFViewEditUser.WebFormCreate(Sender: TObject); ...@@ -194,9 +176,7 @@ procedure TFViewEditUser.WebFormCreate(Sender: TObject);
// Autofills known information about a user on create // Autofills known information about a user on create
begin begin
if FMessage <> '' then if FMessage <> '' then
ShowNotification(FMessage) ShowToast(FMessage);
else
HideNotification;
edtUsername.Text := Username; edtUsername.Text := Username;
edtFullName.Text := FullName; edtFullName.Text := FullName;
if Mode = 'Edit' then if Mode = 'Edit' then
...@@ -221,132 +201,79 @@ begin ...@@ -221,132 +201,79 @@ begin
FViewMain.ShowUserForm(Info); FViewMain.ShowUserForm(Info);
end end
else else
showNotification(Info); showToast(Info);
console.log('Info at Timer:' + Info); console.log('Info at Timer:' + Info);
end; end;
procedure TFViewEditUser.btnConfirmClick(Sender: TObject); procedure TFViewEditUser.btnConfirmClick(Sender: TObject);
// Confirms the edit or addition
var var
checkString: string; FormEl: TJSHTMLFormElement;
charIndex: integer;
phoneNum: string;
begin begin
{ checkString := edtFullName.Text + edtUsername.Text + edtPassword.Text FormEl := TJSHTMLFormElement(document.getElementById('edituserform'));
+ edtConfirmPassword.Text + edtPhoneNumber.Text + edtEmail.Text;
if string(edtFullName.Text).IsEmpty then
begin
ShowNotification('Full Name field is blank!');
exit;
end;
if string(edtUsername.Text).IsEmpty then
begin
ShowNotification('Username field is blank!');
exit;
end;
if string(edtPassword.Text).IsEmpty then if not FormEl.checkValidity then
begin begin
ShowNotification('Password field is blank!'); FormEl.classList.add('was-validated');
exit; Exit;
end; end;
if string(edtConfirmPassword.Text).IsEmpty then Utils.ShowSpinner('spinner');
begin
ShowNotification('Please confirm your password!');
exit;
end;
if string(edtPhoneNumber.Text).IsEmpty then
begin
ShowNotification('Phone Number field is blank!');
exit;
end;
if string(edtEmail.Text).IsEmpty then if Mode = 'Edit' then
begin EditUser
ShowNotification('Email field is blank!'); else
exit; AddUser;
end;
if checkString.Contains('&') then WebTimer1.Enabled := True;
begin end;
ShowNotification('No fields may contain "&&"!');
exit;
end;
if string(edtEmail.Text).Contains('@') = false then
begin
ShowNotification('Please enter a valid email address');
exit;
end;
if (length(string(edtEmail.Text).Split(['@'])) <> 2) or (string(edtEmail.text).CountChar('@') > 1) then procedure TFViewEditUser.ValidatePasswords;
begin var
ShowNotification('Please enter a valid email address'); Pwd, Confirm: string;
exit; PwdInput, ConfirmInput: TJSHTMLInputElement;
end; begin
PwdInput := TJSHTMLInputElement(edtPassword.ElementHandle);
ConfirmInput := TJSHTMLInputElement(edtConfirmPassword.ElementHandle);
phoneNum := edtPhoneNumber.Text; Pwd := PwdInput.value.Trim;
Confirm := ConfirmInput.value.Trim;
if (not phoneNum.Contains('(')) or (not phoneNum.Contains(')')) or (not phoneNum.Contains('-')) then // Disable confirm until password exists
if Pwd = '' then
begin begin
ShowNotification('Please enter a valid phone number'); ConfirmInput.disabled := True;
exit; ConfirmInput.value := '';
end; ConfirmInput.setCustomValidity('');
ConfirmInput.classList.remove('is-invalid');
if (phoneNum.CountChar('(') <> 1) or (phoneNum.CountChar(')') <> 1) or (phoneNum.CountChar('-') <> 1) or (phoneNum.CountChar(' ') > 1) then ConfirmInput.classList.remove('is-valid');
begin end
ShowNotification('Please enter a valid phone number'); else
exit;
end;
phoneNum := phoneNum.Replace('(', '');
phoneNum := phoneNum.Replace(')', '');
phoneNum := phoneNum.Replace('-', '');
phoneNum := phoneNum.Replace(' ', '');
if(length(phoneNum) <> 10) then
begin begin
ShowNotification('Please enter a valid phone number'); ConfirmInput.disabled := False;
exit;
end;
for CharIndex := 1 to Length(phoneNum) do // Live match check
begin if Confirm = '' then
if not (phoneNum[CharIndex] in ['0' .. '9']) then begin
ConfirmInput.setCustomValidity('');
ConfirmInput.classList.remove('is-invalid');
ConfirmInput.classList.remove('is-valid');
end
else if Confirm = Pwd then
begin begin
console.log('here'); ConfirmInput.setCustomValidity('');
ShowNotification('Please enter a valid phone number'); ConfirmInput.classList.add('is-valid');
exit; ConfirmInput.classList.remove('is-invalid');
end
else
begin
ConfirmInput.setCustomValidity('Passwords must match');
ConfirmInput.classList.add('is-invalid');
ConfirmInput.classList.remove('is-valid');
end; end;
end; end;
if edtPassword.Text <> edtConfirmPassword.Text then
begin
ShowNotification('Passwords must match!');
exit;
end;
if (length(edtPassword.Text) > 20) or (length(edtPassword.Text) < 6) then
begin
ShowNotification('Passwords must be between 6-20 characters!');
exit;
end;
}
asm
var modal = document.getElementById('confirmation_modal');
// ensure the modal is directly under <body>
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
var bsModal = new bootstrap.Modal(modal, {
keyboard: false
});
bsModal.show();
end;
end; end;
end. end.
...@@ -41,20 +41,19 @@ object FViewItems: TFViewItems ...@@ -41,20 +41,19 @@ object FViewItems: TFViewItems
'25' '25'
'50') '50')
end end
object btnApply: TWebButton object btnAdd: TWebButton
Left = 478 Left = 565
Top = 128 Top = 318
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Apply' Caption = 'Add'
ChildOrder = 7 ChildOrder = 7
ElementClassName = 'btn btn-light' ElementID = 'btnadd'
ElementID = 'btnapply'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnApplyClick OnClick = btnAddClick
end end
object edtName: TWebEdit object edtName: TWebEdit
Left = 342 Left = 342
...@@ -97,6 +96,70 @@ object FViewItems: TFViewItems ...@@ -97,6 +96,70 @@ object FViewItems: TFViewItems
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btnSave: TWebButton
Left = 565
Top = 228
Width = 96
Height = 25
Caption = 'Save'
ChildOrder = 79
ElementID = 'btnconfirm'
ElementFont = efCSS
ElementPosition = epRelative
Enabled = False
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'null'
WidthPercent = 100.000000000000000000
OnClick = btnSaveClick
end
object btnCancel: TWebButton
Left = 565
Top = 256
Width = 96
Height = 25
Caption = 'Cancel'
ChildOrder = 79
ElementID = 'btncancel'
ElementFont = efCSS
ElementPosition = epRelative
Enabled = False
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'null'
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
object btnDelete: TWebButton
Left = 565
Top = 197
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 79
ElementID = 'btndelete'
ElementFont = efCSS
Enabled = False
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick
end
object btnEdit: TWebButton
Left = 565
Top = 287
Width = 96
Height = 25
Caption = 'Edit'
ChildOrder = 83
ElementID = 'btnedit'
ElementFont = efCSS
Enabled = False
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnEditClick
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 426 Left = 426
......
<nav class="navbar navbar-expand navbar-light bg-light sticky-top" style="z-index: 100;">
<div class="container-fluid ps-0">
<ul class="navbar-nav me-auto ps-2">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
</ul>
</div>
</nav>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="container mt-4"> <div class="container mt-4">
...@@ -30,13 +51,10 @@ ...@@ -30,13 +51,10 @@
<div class="col-sm-5"> <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> <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>
<div class="col-sm-5">
<button class= "ps-3" id="btnapply"></button>
</div>
</div> </div>
</form> </form>
<table class="table table-responsive table-striped table-bordered" id="tblPhoneGrid"> <table class="table table-responsive table-striped table-hover table-bordered" id="tblPhoneGrid">
<thead class="thead-dark"> <thead class="thead-dark">
<tr> <tr>
<th scope="col">ID</th> <th scope="col">ID</th>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// to sort the entries, filter their search, and search for a specific person. // to sort the entries, filter their search, and search for a specific person.
// Authors: // Authors:
// Cameron Hayes // Cameron Hayes
// Mac ... // Mac Stephens
unit View.Items; unit View.Items;
...@@ -12,7 +12,7 @@ uses ...@@ -12,7 +12,7 @@ uses
System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs, System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids, WebLib.Lists, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids, WebLib.Lists,
XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset, XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset,
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, DateUtils, WebAudio; XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, DateUtils;
type type
TFViewItems = class(TWebForm) TFViewItems = class(TWebForm)
...@@ -20,21 +20,30 @@ type ...@@ -20,21 +20,30 @@ type
XDataWebDataSet1: TXDataWebDataSet; XDataWebDataSet1: TXDataWebDataSet;
lblEntries: TWebLabel; lblEntries: TWebLabel;
wcbPageSize: TWebComboBox; wcbPageSize: TWebComboBox;
btnApply: TWebButton; btnAdd: TWebButton;
edtName: TWebEdit; edtName: TWebEdit;
edtDescription: TWebEdit; edtDescription: TWebEdit;
cbStatus: TWebCheckBox; cbStatus: TWebCheckBox;
btnSave: TWebButton;
btnCancel: TWebButton;
btnDelete: TWebButton;
btnEdit: TWebButton;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject); procedure btnAddClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject); procedure wcbPageSizeChange(Sender: TObject);
procedure btnEditClick(Sender: TObject);
procedure btnSaveClick(Sender: TObject);
procedure btnDeleteClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
private private
FChildForm: TWebForm; FChildForm: TWebForm;
procedure AddRowToTable(ID, Name, Description, Status: string); procedure AddRowToTable(ID, Name, Description, Status: string);
procedure ClearTable(); procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer); procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string; function GenerateSearchOptions(): string;
procedure ViewMode();
procedure EditMode();
[async] procedure GetItems(searchOptions: string); [async] procedure GetItems(searchOptions: string);
[async] procedure getUser();
[async] procedure AddItem(itemOptions: string); [async] procedure AddItem(itemOptions: string);
var var
PageNumber: integer; PageNumber: integer;
...@@ -55,7 +64,7 @@ implementation ...@@ -55,7 +64,7 @@ implementation
uses uses
JS, XData.Model.Classes, JS, XData.Model.Classes,
ConnectionModule, Auth.Service, Utils; ConnectionModule, Auth.Service, Utils, View.AddItem, View.Main;
{$R *.dfm} {$R *.dfm}
...@@ -72,56 +81,102 @@ begin ...@@ -72,56 +81,102 @@ begin
getItems(GenerateSearchOptions()); getItems(GenerateSearchOptions());
end; end;
procedure TFViewItems.getUser(); procedure TFViewItems.ViewMode();
var
xdcResponse: TXDataClientResponse;
userList, user: TJSObject;
data: TJSArray;
begin begin
btnAdd.Enabled := true;
btnDelete.Enabled := true;
btnSave.Enabled := false;
btnCancel.Enabled := false;
btnEdit.Enabled := true;
FViewMain.change := false;
edtName.Enabled := false;
edtDescription.enabled := false;
cbStatus.Checked := false;
end;
procedure TFViewItems.EditMode();
begin
FViewMain.change := true;
btnAdd.Enabled := false;
btnDelete.Enabled := false;
btnSave.Enabled := true;
btnCancel.Enabled := True;
btnEdit.Enabled := false;
edtName.Enabled := true;
edtDescription.Enabled := true;
cbStatus.enabled := true;
end; end;
procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string); procedure TFViewItems.AddRowToTable(ID, Name, Description, Status: string);
// Adds rows to the table // Adds one row to #tblPhoneGrid and lets Bootstrap 5.3 highlight the row
// ID: item ID // with its built-in `table-active` class when the user clicks it.
// Name: item name
// Description: item description
// Status: inactive or active
var var
NewRow, Cell, P, Button, Audio: TJSHTMLElement; NewRow, Cell: TJSHTMLElement;
begin begin
NewRow := TJSHTMLElement(document.createElement('tr')); NewRow := TJSHTMLElement(document.createElement('tr'));
// Item ID Cell // Row-select click handler
NewRow.addEventListener('click',
procedure(Event: TJSMouseEvent)
var
TBody : TJSHTMLElement;
Rows : TJSHTMLCollection;
I : Integer;
RowElem : TJSHTMLElement;
begin
// Grab the <tbody> once and cast it
TBody := TJSHTMLElement(
(document.getElementById('tblPhoneGrid') as TJSHTMLElement)
.getElementsByTagName('tbody')[0]
);
// Remove 'table-active' from every existing row
Rows := TBody.children;
for I := 0 to Rows.length - 1 do
begin
RowElem := TJSHTMLElement(Rows.item(I)); // cast Node HTMLElement
RowElem.classList.remove('table-primary');
end;
// Add highlight to the clicked row
TJSHTMLElement(Event.currentTarget).classList.add('table-primary');
end
);
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Item ID'); Cell.setAttribute('data-label', 'Item ID');
Cell.innerText := ID; Cell.innerText := ID;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Name Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Name'); Cell.setAttribute('data-label', 'Name');
Cell.innerText := Name; Cell.innerText := Name;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Description Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Description'); Cell.setAttribute('data-label', 'Description');
Cell.innerText := Description; Cell.innerText := Description;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Status Cell
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Status'); Cell.setAttribute('data-label', 'Status');
Cell.innerText := Status; Cell.innerText := Status;
NewRow.appendChild(Cell); NewRow.appendChild(Cell);
// Appends new rows to the table body TJSHTMLElement(
TJSHTMLElement(document.getElementById('tblPhoneGrid').getElementsByTagName('tbody')[0]).appendChild(NewRow); (document.getElementById('tblPhoneGrid') as TJSHTMLElement)
.getElementsByTagName('tbody')[0]
).appendChild(NewRow);
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
end; end;
procedure TFViewItems.GeneratePagination(TotalPages: Integer); procedure TFViewItems.GeneratePagination(TotalPages: Integer);
// Generates pagination for the table. // Generates pagination for the table.
// TotalPages: Total amount of pages generated by the search // TotalPages: Total amount of pages generated by the search
...@@ -303,64 +358,108 @@ var ...@@ -303,64 +358,108 @@ var
itemListLength: integer; itemListLength: integer;
begin begin
console.log('correct'); console.log('correct');
if PageNumber > 0 then if PageNumber > 0 then
begin begin
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems', try
[searchOptions])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetItems',
itemList := TJSObject(xdcResponse.Result); [searchOptions]));
data := TJSArray(itemList['data']); itemList := TJSObject(xdcResponse.Result);
itemListLength := integer(itemList['count']); data := TJSArray(itemList['data']);
ClearTable(); itemListLength := integer(itemList['count']);
Utils.HideSpinner('Spinner'); ClearTable();
for i := 0 to data.Length - 1 do for i := 0 to data.Length - 1 do
begin begin
item := TJSObject(data[i]); item := TJSObject(data[i]);
AddRowToTable(string(item['ID']), string(item['name']), string(item['description']), AddRowToTable(string(item['ID']), string(item['name']), string(item['description']),
string(item['status'])); string(item['status']));
end; end;
TotalPages := (itemListLength + PageSize - 1) div PageSize; TotalPages := (itemListLength + PageSize - 1) div PageSize;
if (PageNumber * PageSize) < itemListLength then if (PageNumber * PageSize) < itemListLength then
begin begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) + ' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(itemListLength); ' of ' + IntToStr(itemListLength);
end end
else else
begin begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(itemListLength) + ' - ' + IntToStr(itemListLength) +
' of ' + IntToStr(itemListLength); ' of ' + IntToStr(itemListLength);
end;
GeneratePagination(TotalPages);
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve items: ' + E.ErrorResult.ErrorMessage);
end; end;
GeneratePagination(TotalPages); Utils.HideSpinner('spinner');
end; end;
end; end;
procedure TFViewItems.btnApplyClick(Sender: TObject); procedure TFViewItems.btnAddClick(Sender: TObject);
// Button that effectively functions as a GetItems() button // Button that effectively functions as a GetItems() button
var var
itemOptions: string; itemOptions: string;
newform: TFViewAddItem;
begin begin
PageNumber := 1; newform := TFViewAddItem.CreateNew;
PageSize := StrToInt(wcbPageSize.Text);
itemOptions := '&name=' + edtName.Text + newform.Caption := 'Select Item to Add';
'&description=' + edtDescription.Text + newForm.Popup := True;
'&status=' + BoolToStr(cbStatus.Checked); newForm.position:= poScreenCenter;
newForm.Border := fbDialog;
// used to manage Back button handling to close subform
window.location.hash := 'subform';
newform.ShowModal(
procedure(AValue: TModalResult)
begin
getItems(generateSearchOptions());
end
);
end;
console.log('GetItems'); procedure TFViewItems.btnCancelClick(Sender: TObject);
AddItem(itemOptions); begin
ShowToast('Editing items is not yet implemented.', 'info');
end; end;
procedure TFViewItems.btnDeleteClick(Sender: TObject);
begin
ShowToast('Deleting items is no yet implemented.', 'info');
end;
procedure TFViewItems.btnEditClick(Sender: TObject);
begin
ShowToast('Editing items is not yet implemented.', 'info');
//EditMode();
end;
procedure TFViewItems.btnSaveClick(Sender: TObject);
//TODO implement editting items
begin
ShowToast('Editing items is not yet implemented.', 'info');
//ViewMode();
end;
procedure TFViewItems.AddItem(itemOptions: string); procedure TFViewItems.AddItem(itemOptions: string);
// adds an item to the database. // adds an item to the database.
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddItem', try
[itemOptions])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddItem', [itemOptions]));
getItems(GenerateSearchOptions()); getItems(GenerateSearchOptions());
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not add item: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
procedure TFViewItems.wcbPageSizeChange(Sender: TObject); procedure TFViewItems.wcbPageSizeChange(Sender: TObject);
// gets a new amount of items based when the page size is changed // gets a new amount of items based when the page size is changed
begin begin
......
...@@ -57,7 +57,7 @@ object FViewMain: TFViewMain ...@@ -57,7 +57,7 @@ object FViewMain: TFViewMain
end end
object lblAppTitle: TWebLabel object lblAppTitle: TWebLabel
Left = 57 Left = 57
Top = 31 Top = 33
Width = 75 Width = 75
Height = 14 Height = 14
Caption = 'Koehler-Gibson' Caption = 'Koehler-Gibson'
...@@ -157,6 +157,12 @@ object FViewMain: TFViewMain ...@@ -157,6 +157,12 @@ object FViewMain: TFViewMain
ChildOrder = 3 ChildOrder = 3
ElementFont = efCSS ElementFont = efCSS
ElementPosition = epIgnore ElementPosition = epIgnore
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
Role = 'null' Role = 'null'
TabOrder = 0 TabOrder = 0
end end
...@@ -167,12 +173,14 @@ object FViewMain: TFViewMain ...@@ -167,12 +173,14 @@ object FViewMain: TFViewMain
Height = 83 Height = 83
ElementID = 'main.debugmemo' ElementID = 'main.debugmemo'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Lines.Strings = ( Lines.Strings = (
'WebMemo1') 'WebMemo1')
Role = 'null' Role = 'null'
SelLength = 0 SelLength = 0
SelStart = 0 SelStart = 0
ShowFocus = False
Visible = False Visible = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
......
...@@ -47,7 +47,22 @@ ...@@ -47,7 +47,22 @@
</div> </div>
</div> </div>
</nav> </nav>
<!-- Toast wrapper directly under navbar -->
<div id="toast-wrapper"
class="position-fixed top-0 start-0 mt-5 ms-4"
style="z-index: 1080; min-width: 300px; max-width: 500px;">
<div id="bootstrapToast"
class="toast align-items-center text-white bg-success border-0 shadow"
role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body" id="bootstrapToastBody">
Success message
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto"
data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div id="main.webpanel" class="col-12"></div> <div id="main.webpanel" class="col-12"></div>
...@@ -69,6 +84,47 @@ ...@@ -69,6 +84,47 @@
</div> </div>
</div> </div>
<div class="modal fade" id="main_errormodal" tabindex="-1" aria-labelledby="main_lblmodal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content shadow-lg">
<div class="modal-header">
<h5 class="modal-title" id="main_lblmodal">Error</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body fs-6 fw-bold" id="main_lblmodal_body">
Please contact EMSystems to solve the issue.
</div>
<div class="modal-footer justify-content-center">
<button type="button" id="btn_modal_restart" class="btn btn-primary">Back to Orders</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="main_confirmation_modal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content shadow-lg">
<div class="modal-header">
<h5 class="modal-title">Confirm</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body fw-bold" id="main_modal_body">
Placeholder text
</div>
<div class="modal-footer justify-content-center">
<button type="button" class="btn btn-primary me-3" id="btn_confirm_left">Cancel</button>
<button type="button" class="btn btn-secondary" id="btn_confirm_right">Confirm</button>
</div>
</div>
</div>
</div>
...@@ -6,7 +6,7 @@ uses ...@@ -6,7 +6,7 @@ uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls, System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, WEBLib.ExtCtrls, Vcl.Controls, Vcl.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.ExtCtrls, Vcl.Controls, Vcl.StdCtrls,
WEBLib.StdCtrls, Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.StdCtrls, Data.DB, XData.Web.JsonDataset, XData.Web.Dataset,
App.Types, ConnectionModule, XData.Web.Client, WEBLib.Menus; App.Types, ConnectionModule, XData.Web.Client, WEBLib.Menus, Utils;
type type
TFViewMain = class(TWebForm) TFViewMain = class(TWebForm)
...@@ -46,6 +46,7 @@ type ...@@ -46,6 +46,7 @@ type
//procedure EditUser( AParam, BParam, CParam, DParam, EParam: string); //procedure EditUser( AParam, BParam, CParam, DParam, EParam: string);
function GetUserInfo: string; function GetUserInfo: string;
procedure setActive(page: string); procedure setActive(page: string);
procedure ConfirmLogout;
public public
{ Public declarations } { Public declarations }
class procedure Display(LogoutProc: TLogoutProc); class procedure Display(LogoutProc: TLogoutProc);
...@@ -101,7 +102,6 @@ begin ...@@ -101,7 +102,6 @@ begin
ShowForm(TFViewOrders); ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders'; lblAppTitle.Caption := 'Koehler-Gibson Orders';
lblVersion.Caption := 'v' + DMConnection.clientVersion; lblVersion.Caption := 'v' + DMConnection.clientVersion;
setActive('Orders'); setActive('Orders');
end; end;
...@@ -117,7 +117,7 @@ begin ...@@ -117,7 +117,7 @@ begin
setActive('Customers'); setActive('Customers');
end end
else else
ShowMessage('Please Save or Cancel your changes'); ShowToast('Please Save or Cancel your changes', 'danger');
end; end;
procedure TFViewMain.lblHomeClick(Sender: TObject); procedure TFViewMain.lblHomeClick(Sender: TObject);
...@@ -129,12 +129,11 @@ begin ...@@ -129,12 +129,11 @@ begin
//setActive('Home'); //setActive('Home');
end end
else else
ShowMessage('Please Save or Cancel your changes'); ShowToast('Please Save or Cancel your changes', 'danger');
end; end;
procedure TFViewMain.lblordersClick(Sender: TObject); procedure TFViewMain.lblordersClick(Sender: TObject);
begin begin
console.log(change);
if ( not ( change ) ) then if ( not ( change ) ) then
begin begin
ShowForm(TFViewOrders); ShowForm(TFViewOrders);
...@@ -142,7 +141,7 @@ begin ...@@ -142,7 +141,7 @@ begin
setActive('Orders'); setActive('Orders');
end end
else else
ShowMessage('Please Save or Cancel your changes'); ShowToast('Please Save or Cancel your changes', 'danger');
end; end;
procedure TFViewMain.lblQuickbooksClick(Sender: TObject); procedure TFViewMain.lblQuickbooksClick(Sender: TObject);
...@@ -154,7 +153,7 @@ begin ...@@ -154,7 +153,7 @@ begin
setActive('QuickBooks'); setActive('QuickBooks');
end end
else else
ShowMessage('Please Save or Cancel your changes'); ShowToast('Please Save or Cancel your changes', 'danger');
end; end;
procedure TFViewMain.lblUsersClick(Sender: TObject); procedure TFViewMain.lblUsersClick(Sender: TObject);
...@@ -165,7 +164,7 @@ begin ...@@ -165,7 +164,7 @@ begin
lblAppTitle.Caption := 'Koehler-Gibson Users'; lblAppTitle.Caption := 'Koehler-Gibson Users';
end end
else else
ShowMessage('Please Save or Cancel your changes'); ShowToast('Please Save or Cancel your changes', 'danger');
end; end;
procedure TFViewMain.lblItemsListClick(Sender: TObject); procedure TFViewMain.lblItemsListClick(Sender: TObject);
...@@ -177,7 +176,7 @@ begin ...@@ -177,7 +176,7 @@ begin
setActive('Items'); setActive('Items');
end end
else else
ShowMessage('Please Save or Cancel your changes'); ShowToast('Please Save or Cancel your changes', 'danger');
end; end;
procedure TFViewMain.setActive(page: string); procedure TFViewMain.setActive(page: string);
...@@ -200,13 +199,28 @@ end; ...@@ -200,13 +199,28 @@ end;
procedure TFViewMain.mnuLogoutClick(Sender: TObject); procedure TFViewMain.mnuLogoutClick(Sender: TObject);
begin begin
FLogoutProc; ConfirmLogout;
end; end;
procedure TFViewMain.wllblLogoutClick(Sender: TObject); procedure TFViewMain.wllblLogoutClick(Sender: TObject);
begin begin
FLogoutProc; ConfirmLogout;
end;
procedure TFViewMain.ConfirmLogout;
begin
ShowConfirmationModal(
'Are you sure you want to log out?',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed and Assigned(FLogoutProc) then
FLogoutProc('');
end
);
end; end;
...@@ -315,4 +329,5 @@ begin ...@@ -315,4 +329,5 @@ begin
FChildForm := TFViewUsers.CreateForm(WebPanel1.ElementID, Info); FChildForm := TFViewUsers.CreateForm(WebPanel1.ElementID, Info);
end; end;
end. end.
...@@ -8,7 +8,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -8,7 +8,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Font.Style = [] Font.Style = []
ParentFont = False ParentFont = False
OnCreate = WebFormCreate OnCreate = WebFormCreate
OnShow = WebFormShow
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 34 Left = 34
Top = 188 Top = 188
...@@ -99,40 +98,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -99,40 +98,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Visible = False Visible = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object pnlMessage: TWebPanel object lblFormState: TWebLabel
Left = 324 Left = 18
Top = 19 Top = 16
Width = 121 Width = 3
Height = 33 Height = 14
ElementID = 'view.login.message' ElementID = 'lbl_form_state'
ChildOrder = 5 HeightPercent = 100.000000000000000000
ElementPosition = epRelative WidthPercent = 100.000000000000000000
Role = 'null'
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 = 'null'
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end end
object dtpOrderDate: TWebDateTimePicker object dtpOrderDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -147,7 +120,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -147,7 +120,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
Role = 'null' Role = 'null'
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpProofDate: TWebDateTimePicker object dtpProofDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -162,7 +134,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -162,7 +134,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
Role = 'null' Role = 'null'
Text = '' Text = ''
OnChange = dtpProofDateChange
end end
object dtpShipDate: TWebDateTimePicker object dtpShipDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -177,7 +148,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -177,7 +148,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
Role = 'null' Role = 'null'
Text = '' Text = ''
OnChange = dtpShipDateChange
end end
object dtpArtDue: TWebDateTimePicker object dtpArtDue: TWebDateTimePicker
Left = 24 Left = 24
...@@ -206,7 +176,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -206,7 +176,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
Role = 'null' Role = 'null'
Text = '' Text = ''
OnChange = dtpPlateDueChange
end end
object dtpMountDue: TWebDateTimePicker object dtpMountDue: TWebDateTimePicker
Left = 24 Left = 24
...@@ -221,7 +190,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -221,7 +190,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
Role = 'null' Role = 'null'
Text = '' Text = ''
OnChange = dtpMountDueChange
end end
object btnAddColor: TWebButton object btnAddColor: TWebButton
Left = 658 Left = 658
...@@ -234,6 +202,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -234,6 +202,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnAddColorClick OnClick = btnAddColorClick
end end
...@@ -249,8 +218,9 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -249,8 +218,9 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Date = 45748.499176770830000000 Date = 45748.499176770830000000
ElementPosition = epRelative ElementPosition = epRelative
Role = 'null' Role = 'null'
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpApprovedDateChange
end end
object edtCompanyName: TWebDBEdit object edtCompanyName: TWebDBEdit
Left = 18 Left = 18
...@@ -315,7 +285,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -315,7 +285,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object edtQuantity: TWebDBEdit object edtQuantity: TWebDBEdit
Left = 24 Left = 26
Top = 346 Top = 346
Width = 121 Width = 121
Height = 22 Height = 22
...@@ -519,6 +489,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -519,6 +489,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'mounting_custom_adhesive' DataField = 'mounting_custom_adhesive'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -599,16 +570,18 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -599,16 +570,18 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object edtProofOther: TWebDBEdit object edtProofOther: TWebDBEdit
Left = 666 Left = 658
Top = 458 Top = 458
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtproofother' ElementID = 'edtproofother'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_other' DataField = 'proofing_other'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -618,12 +591,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -618,12 +591,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 328 Top = 328
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtproofshipto' ElementID = 'edtproofshipto'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_ship_to' DataField = 'proofing_ship_to'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -633,12 +608,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -633,12 +608,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 300 Top = 300
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtemailattn' ElementID = 'edtemailattn'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_e_mail_attn' DataField = 'proofing_e_mail_attn'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -648,12 +625,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -648,12 +625,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 272 Top = 272
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtproofemail' ElementID = 'edtproofemail'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_e_mail' DataField = 'proofing_e_mail'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -663,12 +642,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -663,12 +642,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 244 Top = 244
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtfaxattn' ElementID = 'edtfaxattn'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_fax_attn' DataField = 'proofing_fax_attn'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -678,12 +659,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -678,12 +659,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 219 Top = 219
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtfax' ElementID = 'edtfax'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_fax' DataField = 'proofing_fax'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -699,6 +682,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -699,6 +682,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'colors_clemson' DataField = 'colors_clemson'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -714,6 +698,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -714,6 +698,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'colors_cross_hairs' DataField = 'colors_cross_hairs'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -729,6 +714,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -729,6 +714,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'colors_machine_ident' DataField = 'colors_machine_ident'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -744,6 +730,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -744,6 +730,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'colors_cylinder_size' DataField = 'colors_cylinder_size'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -753,12 +740,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -753,12 +740,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 105 Top = 105
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtjobnumber' ElementID = 'edtjobnumber'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plates_job_number' DataField = 'plates_job_number'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -768,12 +757,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -768,12 +757,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 480 Top = 480
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Art Approved As Is' Caption = 'Art Approved As Is'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbartapprovedasis' ElementID = 'cbartapprovedasis'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_art_approved_as_is' DataField = 'proofing_art_approved_as_is'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -785,12 +777,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -785,12 +777,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 430 Top = 430
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'PDF File' Caption = 'PDF File'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbpdffile' ElementID = 'cbpdffile'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf_file' DataField = 'proofing_pdf_file'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -802,12 +797,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -802,12 +797,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 406 Top = 406
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Wide Format' Caption = 'Wide Format'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbwideformat' ElementID = 'cbwideformat'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_wide_format' DataField = 'proofing_wide_format'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -819,12 +817,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -819,12 +817,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 382 Top = 382
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Print Card' Caption = 'Print Card'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbprintcard' ElementID = 'cbprintcard'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_print_card' DataField = 'proofing_print_card'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -836,12 +837,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -836,12 +837,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 356 Top = 356
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Full Size Panel' Caption = 'Full Size Panel'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbfullsizepanel' ElementID = 'cbfullsizepanel'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_full_size_panel' DataField = 'proofing_full_size_panel'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -853,12 +857,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -853,12 +857,14 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 185 Top = 185
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 78 ChildOrder = 78
ElementID = 'edtspecialinstructions' ElementID = 'edtspecialinstructions'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'general_special_instructions' DataField = 'general_special_instructions'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -886,8 +892,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -886,8 +892,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'edtrefartapdf' ElementID = 'edtrefartapdf'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbRefArtPrintCard: TWebCheckBox object cbRefArtPrintCard: TWebCheckBox
...@@ -899,8 +907,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -899,8 +907,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'edtrefartprintcard' ElementID = 'edtrefartprintcard'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbExistingCuttingDie: TWebCheckBox object cbExistingCuttingDie: TWebCheckBox
...@@ -912,8 +922,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -912,8 +922,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'edtexistingcuttingdie' ElementID = 'edtexistingcuttingdie'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbFTP: TWebCheckBox object cbFTP: TWebCheckBox
...@@ -925,8 +937,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -925,8 +937,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbftp' ElementID = 'cbftp'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbSampleCarton: TWebCheckBox object cbSampleCarton: TWebCheckBox
...@@ -938,8 +952,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -938,8 +952,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbsampleCarton' ElementID = 'cbsampleCarton'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbPlates: TWebCheckBox object cbPlates: TWebCheckBox
...@@ -951,8 +967,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -951,8 +967,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbplates' ElementID = 'cbplates'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbColorCopy: TWebCheckBox object cbColorCopy: TWebCheckBox
...@@ -964,8 +982,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -964,8 +982,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbcolorcopy' ElementID = 'cbcolorcopy'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbStripMount: TWebCheckBox object cbStripMount: TWebCheckBox
...@@ -977,8 +997,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -977,8 +997,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbstripmount' ElementID = 'cbstripmount'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbFullMount: TWebCheckBox object cbFullMount: TWebCheckBox
...@@ -990,8 +1012,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -990,8 +1012,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbfullmount' ElementID = 'cbfullmount'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbStickyBak: TWebCheckBox object cbStickyBak: TWebCheckBox
...@@ -1003,8 +1027,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1003,8 +1027,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbstickybak' ElementID = 'cbstickybak'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbLoose: TWebCheckBox object cbLoose: TWebCheckBox
...@@ -1016,8 +1042,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1016,8 +1042,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbloose' ElementID = 'cbloose'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object cbExcaliburDie: TWebCheckBox object cbExcaliburDie: TWebCheckBox
...@@ -1029,8 +1057,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1029,8 +1057,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 76 ChildOrder = 76
ElementID = 'cbexcaliburdie' ElementID = 'cbexcaliburdie'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebDBComboBox1: TWebDBComboBox object WebDBComboBox1: TWebDBComboBox
...@@ -1058,8 +1088,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1058,8 +1088,10 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 75 ChildOrder = 75
ElementID = 'edtemail' ElementID = 'edtemail'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btnCancel: TWebButton object btnCancel: TWebButton
...@@ -1101,6 +1133,8 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1101,6 +1133,8 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
...@@ -1111,13 +1145,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1111,13 +1145,15 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
end end
object WebDBComboBox4: TWebDBComboBox object WebDBComboBox4: TWebDBComboBox
Left = 833 Left = 833
Top = 48 Top = 49
Width = 145 Width = 145
Height = 22 Height = 22
ElementID = 'wcbthickness' ElementID = 'wcbthickness'
ElementPosition = epRelative ElementPosition = epRelative
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
Role = 'null' Role = 'null'
ShowFocus = False
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
...@@ -1190,18 +1226,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1190,18 +1226,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btn_confirm_delete: TWebButton
Left = 1094
Top = 414
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object btnEdit: TWebButton object btnEdit: TWebButton
Left = 1202 Left = 1202
Top = 560 Top = 560
...@@ -1235,6 +1259,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1235,6 +1259,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85 ChildOrder = 85
ElementID = 'btnaddaddress' ElementID = 'btnaddaddress'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = WebButton2Click OnClick = WebButton2Click
end end
...@@ -1243,14 +1268,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1243,14 +1268,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Left = 1014 Left = 1014
Top = 44 Top = 44
end end
object tmrScrollTop: TWebTimer
Interval = 100
OnTimer = tmrScrollTopTimer
Left = 1176
Top = 256
end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 1060 Left = 1060
Top = 182 Top = 182
...@@ -1542,17 +1560,18 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1542,17 +1560,18 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
end end
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
AutoEdit = False
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
Left = 1176 Left = 1176
Top = 182 Top = 182
end end
object wdsShipTo: TWebDataSource object wdsShipTo: TWebDataSource
AutoEdit = False
DataSet = xdwdsShipTo DataSet = xdwdsShipTo
Left = 1090 Left = 1090
Top = 124 Top = 124
end end
object xdwdsShipTo: TXDataWebDataSet object xdwdsShipTo: TXDataWebDataSet
AfterEdit = xdwdsShipToAfterEdit
Left = 1096 Left = 1096
Top = 40 Top = 40
object xdwdsShipToADDRESS: TStringField object xdwdsShipToADDRESS: TStringField
...@@ -1560,12 +1579,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated ...@@ -1560,12 +1579,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
end end
end end
object wdsQBItem: TWebDataSource object wdsQBItem: TWebDataSource
AutoEdit = False
DataSet = xdwdsQBItem DataSet = xdwdsQBItem
Left = 1172 Left = 1172
Top = 128 Top = 128
end end
object xdwdsQBItem: TXDataWebDataSet object xdwdsQBItem: TXDataWebDataSet
AfterEdit = xdwdsQBItemAfterEdit
Left = 1174 Left = 1174
Top = 38 Top = 38
object xdwdsQBItemname: TStringField object xdwdsQBItemname: TStringField
......
<nav class="navbar navbar-expand navbar-light bg-light border-light sticky-top" style="z-index: 100;">
<div class="container-fluid d-flex align-items-center ps-0 pe-0">
<nav class="navbar navbar-expand navbar-light bg-light border-light sticky-top" style="z-index: 100;"> <!-- Left-aligned label -->
<div class="container-fluid ps-0"> <div class="me-auto ps-3">
<div id="view.login.message" class="alert alert-danger" <label id="lbl_form_state" class="form-label mb-0 fw-bold text-uppercase text-nowrap text-danger" style="font-size: 16px;">Test</label>
style="padding: 0.25rem 0.5rem; font-size: 0.875rem; line-height: 1.5; display: flex; align-items: center; margin: 0 0 0 60px; height: 32px; width: 400px;">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
<ul class="navbar-nav me-auto ps-2">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btncopy" class="btn btn-primary btn-sm">Copy</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-primary btn-sm">Close</button>
</li>
</ul>
</div> </div>
<!-- Right-aligned buttons -->
<ul class="navbar-nav ms-auto pe-2 mb-0">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btncopy" class="btn btn-primary btn-sm">Copy</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-primary btn-sm">Close</button>
</li>
</ul>
</div>
</nav> </nav>
<div class="row mx-5"> <div class="row mx-5">
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
...@@ -220,7 +222,7 @@ ...@@ -220,7 +222,7 @@
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" class="form-label mt-2">Loose:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Loose:</label>
<input type="checkbox" id="cbloose"> <input type="checkbox" id="cbloose">
<input id="edtloose" class="form-control input-sm" style="width: 150px"/> <input id="edtloose" class="form-control input-sm" style="width: 150px"/>
</div> </div>
...@@ -362,28 +364,4 @@ ...@@ -362,28 +364,4 @@
<textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea> <textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea>
</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">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmation_modal_label">Confirm</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="modal_body">
Are you sure you want to delete this order?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id= 'btn_confirm_cancel'>Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_delete">Delete</button>
</div>
</div> </div>
</div>
</div>
<style>
.modal-backdrop {
opacity: 0 !important;
}
</style>
...@@ -9,13 +9,10 @@ uses ...@@ -9,13 +9,10 @@ uses
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage, WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls, ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB; Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, VCL.Forms;
type type
TFOrderEntryCorrugated = class(TWebForm) TFOrderEntryCorrugated = class(TWebForm)
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
dtpOrderDate: TWebDateTimePicker; dtpOrderDate: TWebDateTimePicker;
dtpProofDate: TWebDateTimePicker; dtpProofDate: TWebDateTimePicker;
dtpShipDate: TWebDateTimePicker; dtpShipDate: TWebDateTimePicker;
...@@ -74,7 +71,6 @@ type ...@@ -74,7 +71,6 @@ type
cbFullSizePanel: TWebDBCheckBox; cbFullSizePanel: TWebDBCheckBox;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
edtSpecialInstructions: TWebDBEdit; edtSpecialInstructions: TWebDBEdit;
tmrScrollTop: TWebTimer;
XDataWebDataSet1: TXDataWebDataSet; XDataWebDataSet1: TXDataWebDataSet;
WebDataSource1: TWebDataSource; WebDataSource1: TWebDataSource;
btnSave: TWebButton; btnSave: TWebButton;
...@@ -198,18 +194,14 @@ type ...@@ -198,18 +194,14 @@ type
btnDelete: TWebButton; btnDelete: TWebButton;
btnClose: TWebButton; btnClose: TWebButton;
edtOrderNum: TWebEdit; edtOrderNum: TWebEdit;
btn_confirm_delete: TWebButton;
tmrReturn: TWebTimer; tmrReturn: TWebTimer;
btnEdit: TWebButton; btnEdit: TWebButton;
btnAdd: TWebButton; btnAdd: TWebButton;
WebButton2: TWebButton; WebButton2: TWebButton;
lblFormState: TWebLabel;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure WebFormShow(Sender: TObject);
[async] procedure getOrder(Order_ID: string); [async] procedure getOrder(Order_ID: string);
[async] procedure getCustomer(customerID: string); [async] procedure getCustomer(customerID: string);
procedure tmrScrollTopTimer(Sender: TObject);
procedure btnAddColorClick(Sender: TObject); procedure btnAddColorClick(Sender: TObject);
procedure addColorRow(num, Color, LPI, Size: string); procedure addColorRow(num, Color, LPI, Size: string);
procedure btnSaveClick(Sender: TObject); procedure btnSaveClick(Sender: TObject);
...@@ -221,23 +213,12 @@ type ...@@ -221,23 +213,12 @@ type
procedure btnCopyClick(Sender: TObject); procedure btnCopyClick(Sender: TObject);
procedure sendOrderToServer(); procedure sendOrderToServer();
procedure btnCloseClick(Sender: TObject); procedure btnCloseClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
procedure btnDeleteClick(Sender: TObject); procedure btnDeleteClick(Sender: TObject);
procedure btn_confirm_deleteClick(Sender: TObject);
procedure tmrReturnTimer(Sender: TObject); procedure tmrReturnTimer(Sender: TObject);
function VerifyOrder(): boolean; function VerifyOrder(): boolean;
procedure XDataWebDataSet1AfterEdit(DataSet: TDataSet);
procedure xdwdsShipToAfterEdit(DataSet: TDataSet);
procedure dtpApprovedDateChange(Sender: TObject);
procedure dtpMountDueChange(Sender: TObject);
procedure dtpPlateDueChange(Sender: TObject);
procedure dtpShipDateChange(Sender: TObject);
procedure dtpProofDateChange(Sender: TObject);
procedure dtpOrderDateChange(Sender: TObject);
procedure EditMode(); procedure EditMode();
procedure btnEditClick(Sender: TObject); procedure btnEditClick(Sender: TObject);
procedure btnAddClick(Sender: TObject); procedure btnAddClick(Sender: TObject);
procedure xdwdsQBItemAfterEdit(DataSet: TDataSet);
procedure ViewMode(); procedure ViewMode();
procedure WebButton2Click(Sender: TObject); procedure WebButton2Click(Sender: TObject);
procedure ShowAddAddressForm(); procedure ShowAddAddressForm();
...@@ -246,14 +227,16 @@ type ...@@ -246,14 +227,16 @@ type
FAgencyCode: string; FAgencyCode: string;
FCurrentReportType: string; FCurrentReportType: string;
FSelectProc: TSelectProc; FSelectProc: TSelectProc;
mode: string;
orderID: string; orderID: string;
customerID: string; customerID: string;
mode: string;
changed: boolean; changed: boolean;
notification: string; notification: string;
procedure RemoveColorRow(Sender: TObject);
[async] procedure InitializeForm;
//FJSONProc1: TJSONProc1; //FJSONProc1: TJSONProc1;
public public
class function CreateForm(AElementID, orderInfo, customerInfo, mode, info: string): TWebForm; class function CreateForm(AElementID, orderInfo, customerInfo, modeparam, info: string): TWebForm;
end; end;
var var
...@@ -266,6 +249,45 @@ implementation ...@@ -266,6 +249,45 @@ implementation
uses uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils; View.Home, View.Main, View.AddOrder, View.AddAddress, Utils;
class function TFOrderEntryCorrugated.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
begin
Application.CreateForm(TFOrderEntryCorrugated, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntryCorrugated(AForm) do
begin
customerID := customerInfo;
orderID := orderInfo;
mode := modeParam;
notification := info;
console.log('Mode in createform: ' + modeParam);
InitializeForm;
end;
end
);
end;
[async] procedure TFOrderEntryCorrugated.InitializeForm;
begin
if mode = 'ADD' then
begin
await(getCustomer(customerID));
EditMode;
end
else
begin
await(getOrder(orderID));
ViewMode;
end;
edtOrderNum.Text := orderID;
if notification <> '' then
ShowToast(notification);
end;
procedure TFOrderEntryCorrugated.sendOrderToServer(); procedure TFOrderEntryCorrugated.sendOrderToServer();
// This can be improved. I was struggling to get the checkboxes to work with // This can be improved. I was struggling to get the checkboxes to work with
// The dataset at first, but if you just change the fields in the database to be // The dataset at first, but if you just change the fields in the database to be
...@@ -383,7 +405,11 @@ begin ...@@ -383,7 +405,11 @@ begin
if Field is TStringField then if Field is TStringField then
begin begin
if Field.AsString = '' then if Field.AsString = '' then
orderJSON.AddPair(Field.FieldName, '') begin
orderJSON.AddPair(Field.FieldName, '');
console.log(Field.FieldName);
console.log(Field.AsString);
end
else else
orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
end end
...@@ -403,14 +429,10 @@ begin ...@@ -403,14 +429,10 @@ begin
if mode = 'EDIT' then if mode = 'EDIT' then
orderJSON.AddPair('ORDER_ID', orderID); orderJSON.AddPair('ORDER_ID', orderID);
if mode = 'ADD' then
ShowNotification('Success:Order Added Successfully!')
else
ShowNotification('Success:Order Edited Successfully');
AddCorrugatedOrder(orderJSON); AddCorrugatedOrder(orderJSON);
end; end;
procedure TFOrderEntryCorrugated.btnSaveClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnSaveClick(Sender: TObject);
// Converts all the information on the page into a JSON to then send to the server // Converts all the information on the page into a JSON to then send to the server
begin begin
...@@ -436,7 +458,6 @@ begin ...@@ -436,7 +458,6 @@ begin
else else
input.classList.remove('is-invalid'); input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtaccountcompanyname')); input := TJSHTMLInputElement(document.getElementById('edtaccountcompanyname'));
if edtCompanyAccountName.Text = '' then if edtCompanyAccountName.Text = '' then
begin begin
...@@ -476,6 +497,7 @@ begin ...@@ -476,6 +497,7 @@ begin
input.classList.remove('is-invalid'); input.classList.remove('is-invalid');
end; end;
procedure TFOrderEntryCorrugated.btnCopyClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnCopyClick(Sender: TObject);
begin begin
mode := 'ADD'; mode := 'ADD';
...@@ -489,73 +511,44 @@ begin ...@@ -489,73 +511,44 @@ begin
dtpApprovedDate.Date := 0; dtpApprovedDate.Date := 0;
edtOrderNum.Text := ''; edtOrderNum.Text := '';
EditMode(); EditMode();
ShowNotification('Success:Order Successfully Copied'); ShowToast('Success: Order Successfully Copied');
window.scrollTo(0, 0); window.scrollTo(0, 0);
end; end;
procedure TFOrderEntryCorrugated.btnDeleteClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnDeleteClick(Sender: TObject);
begin begin
document.getElementById('modal_body').innerHTML := 'Are you sure you want to delete this order?'; ShowConfirmationModal(
document.getElementById('btn_confirm_cancel').innerText := 'Cancel'; 'Are you sure you want to delete this order?',
document.getElementById('btn_confirm_delete').innerText := 'Delete'; 'Delete',
asm 'Cancel',
var modal = document.getElementById('confirmation_modal'); procedure(confirmed: Boolean)
// ensure the modal lives directly under <body> begin
if (modal && modal.parentNode !== document.body) { if confirmed then
document.body.appendChild(modal); begin
} Utils.ShowSpinner('spinner');
DelOrder();
var bsModal = new bootstrap.Modal(modal, { tmrReturn.Enabled := true;
keyboard: false end;
}); end
bsModal.show(); );
end;
end; end;
procedure TFOrderEntryCorrugated.btnEditClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnEditClick(Sender: TObject);
begin begin
EditMode(); EditMode();
end; end;
procedure TFOrderEntryCorrugated.btnPDFClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnPDFClick(Sender: TObject);
begin begin
if mode = 'EDIT' then if mode = 'EDIT' then
GenerateReportPDF GenerateReportPDF
else else
showNotification('Failure:Cannot Generate PDF when Adding an Order'); ShowToast('Failure: Cannot Generate PDF when Adding an Order');
end; end;
procedure TFOrderEntryCorrugated.btn_confirm_deleteClick(Sender: TObject);
begin
if document.getElementById('btn_confirm_delete').innerText = 'Yes' then
begin
FViewMain.change := false;
if OrderID <> '' then
begin
FViewMain.ViewOrderEntryCorrugated(OrderID, '', 'EDIT', 'Failure:Changes Discarded');
end
else
FViewMain.ViewOrders('');
end
else
begin
Utils.ShowSpinner('spinner');
asm
var modal = document.getElementById('confirmation_modal');
// ensure the modal lives directly under <body>
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
var bsModal = new bootstrap.Modal(modal, {
keyboard: false
});
bsModal.hide();
end;
delOrder();
tmrReturn.Enabled := true;
end;
end;
[async] procedure TFOrderEntryCorrugated.GenerateReportPDF; [async] procedure TFOrderEntryCorrugated.GenerateReportPDF;
// sends the search to the server which then sends back a pdf of the results // sends the search to the server which then sends back a pdf of the results
...@@ -564,122 +557,141 @@ var ...@@ -564,122 +557,141 @@ var
searchOptions, pdfURL: string; searchOptions, pdfURL: string;
jsObject: TJSObject; jsObject: TJSObject;
begin begin
try
// Call the server method to generate the PDF // Call the server method to generate the PDF
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderCorrugatedPDF', [orderID])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderCorrugatedPDF', [orderID]));
jsObject := JS.TJSObject(xdcResponse.Result); jsObject := JS.TJSObject(xdcResponse.Result);
pdfURL := JS.toString(jsObject.Properties['value']); pdfURL := JS.toString(jsObject.Properties['value']);
// Open the PDF in a new browser tab without needing a different form // Open the PDF in a new browser tab without needing a different form
// This method is much faster too, even for large datasets // This method is much faster too, even for large datasets
window.open(pdfURL, '_blank'); window.open(pdfURL, '_blank');
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not generate corrugated PDF: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
procedure TFOrderEntryCorrugated.AddCorrugatedOrder(orderJSON: TJSONObject); procedure TFOrderEntryCorrugated.AddCorrugatedOrder(orderJSON: TJSONObject);
// sends the order JSON object to the server // sends the order JSON object to the server
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
jsObj: TJSObject; jsObj: TJSObject;
begin begin
console.log(orderJSON);
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCorrugatedOrder', Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCorrugatedOrder',
[orderJSON.ToString])); [orderJSON.ToString]));
jsObj := JS.TJSObject(Response.Result); jsObj := JS.TJSObject(Response.Result);
if mode = 'ADD' then if mode = 'ADD' then
OrderID := String(jsObj.Properties['OrderID']); OrderID := String(jsObj.Properties['OrderID']);
edtOrderNum.Text := OrderID;
mode := 'EDIT'; mode := 'EDIT';
ShowToast(string(jsObj.Properties['status']));
end; end;
procedure TFOrderEntryCorrugated.DelOrder(); procedure TFOrderEntryCorrugated.DelOrder();
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
begin begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelOrder', try
[OrderID, 'corrugated', JS.toString(AuthService.TokenPayload.Properties['user_id'])])); Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelOrder',
[OrderID, 'corrugated', JS.toString(AuthService.TokenPayload.Properties['user_id'])]));
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not delete order: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
class function TFOrderEntryCorrugated.CreateForm(AElementID, orderInfo, customerInfo, mode, info: string): TWebForm;
procedure TFOrderEntryCorrugated.addColorRow(num, color, LPI, size: string);
var var
localMode: string; container, newRow, col, labelEl, inputEl, removeCol: TJSHTMLElement;
removeBtn: TWebButton;
values: array[0..3] of string;
labels: array[0..3] of string;
i: Integer;
begin begin
localMode := mode; container := TJSHTMLElement(document.getElementById('additionalFields'));
Application.CreateForm(TFOrderEntryCorrugated, AElementID, Result,
procedure(AForm: TObject) // Create the new row container
begin newRow := TJSHTMLElement(document.createElement('div'));
with TFOrderEntryCorrugated(AForm) do newRow.className := 'row mb-2';
begin
TFOrderEntryCorrugated(AForm).customerID := customerInfo; labels[0] := '#'; values[0] := num;
TFOrderEntryCorrugated(AForm).orderID := orderInfo; labels[1] := 'Color'; values[1] := color;
TFOrderEntryCorrugated(AForm).mode := localMode; labels[2] := 'LPI'; values[2] := LPI;
TFOrderEntryCorrugated(AForm).notification := info; labels[3] := 'Size'; values[3] := size;
end;
end for i := 0 to 3 do
); begin
col := TJSHTMLElement(document.createElement('div'));
col.className := 'col-sm';
labelEl := TJSHTMLElement(document.createElement('label'));
labelEl.className := 'pe-2';
labelEl.style.setProperty('font-weight', '700');
labelEl.style.setProperty('font-size', '15px');
labelEl.textContent := labels[i] + ':';
inputEl := TJSHTMLElement(document.createElement('input'));
inputEl.className := 'form-control input-sm';
inputEl.setAttribute('style', 'width: 100%');
inputEl.setAttribute('value', values[i]);
inputEl.setAttribute('id', 'input-' + IntToStr(container.childElementCount) + '-' + IntToStr(i));
col.appendChild(labelEl);
col.appendChild(inputEl);
newRow.appendChild(col);
end;
// Add remove button
removeCol := TJSHTMLElement(document.createElement('div'));
removeCol.className := 'col-auto d-flex align-items-end pb-1';
removeBtn := TWebButton.Create(Self);
removeBtn.Caption := 'Remove';
removeBtn.ElementClassName := 'btn btn-danger btn-sm mt-1';
removeBtn.ParentElement := removeCol;
removeBtn.ElementHandle.style.setProperty('height', '30px');
removeBtn.OnClick := RemoveColorRow;
newRow.appendChild(removeCol);
container.appendChild(newRow);
end; end;
procedure TFOrderEntryCorrugated.addColorRow(num: string; Color: string; LPI: string; Size: string);
// Java script code to add a row of colors when a button is clicked procedure TFOrderEntryCorrugated.RemoveColorRow(Sender: TObject);
// all variables are information to be placed in the boxes when loading an order. var
// TODO: convert to Delphi btn: TWebButton;
rowElement: TJSHTMLElement;
begin begin
asm EditMode();
const container = document.getElementById('additionalFields'); btn := TWebButton(Sender);
if Assigned(btn.ElementHandle) and Assigned(btn.ElementHandle.parentElement) then
// Create a new row for the new fields begin
const newRow = document.createElement('div'); // Assuming button is inside a <div> inside the row
newRow.className = 'row mb-2'; rowElement := TJSHTMLElement(btn.ElementHandle.parentElement.parentElement);
if Assigned(rowElement) then
const labels = ['#', 'Color', 'LPI', 'Size']; rowElement.remove;
const values = [num, Color, LPI, Size]; end;
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 mt-3';
const removeButton = document.createElement('button');
removeButton.className = 'btn btn-danger btn-sm mt-1';
removeButton.textContent = 'Remove';
removeButton.addEventListener('click', function() {
container.removeChild(newRow);
});
removeButtonCol.appendChild(removeButton);
newRow.appendChild(removeButtonCol);
container.appendChild(newRow);
end;
end; end;
procedure TFOrderEntryCorrugated.btnAddColorClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnAddColorClick(Sender: TObject);
begin begin
EditMode();
addColorRow('','','',''); addColorRow('','','','');
end; end;
procedure TFOrderEntryCorrugated.WebButton2Click(Sender: TObject); procedure TFOrderEntryCorrugated.WebButton2Click(Sender: TObject);
begin begin
ShowAddAddressForm(); ShowAddAddressForm();
end; end;
procedure TFOrderEntryCorrugated.SendAddressToServer(AddressJSON: TJSONObject); procedure TFOrderEntryCorrugated.SendAddressToServer(AddressJSON: TJSONObject);
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
...@@ -689,12 +701,13 @@ begin ...@@ -689,12 +701,13 @@ begin
[AddressJSON.ToString])); [AddressJSON.ToString]));
notification := TJSObject(Response.Result); notification := TJSObject(Response.Result);
ShowNotification(string(notification['status'])); ShowToast(string(notification['status']));
xdwdsShipTo.Close; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(notification['ADDRESS']); xdwdsShipTo.SetJSONData(notification['ADDRESS']);
xdwdsShipTo.Open; xdwdsShipTo.Open;
end; end;
procedure TFOrderEntryCorrugated.ShowAddAddressForm; procedure TFOrderEntryCorrugated.ShowAddAddressForm;
// displays the search pop-up that allows the user to filter the order list // displays the search pop-up that allows the user to filter the order list
var var
...@@ -706,6 +719,7 @@ begin ...@@ -706,6 +719,7 @@ begin
newform.Caption := 'Input Shipping Information'; newform.Caption := 'Input Shipping Information';
newForm.Popup := True; newForm.Popup := True;
newForm.Position := poScreenCenter;
newForm.Border := fbDialog; newForm.Border := fbDialog;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
...@@ -751,6 +765,7 @@ begin ...@@ -751,6 +765,7 @@ begin
newform.Caption := 'Select Customer and Order Type'; newform.Caption := 'Select Customer and Order Type';
newForm.Popup := True; newForm.Popup := True;
newForm.Position := poScreenCenter;
newForm.Border := fbDialog; newForm.Border := fbDialog;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
...@@ -779,34 +794,33 @@ begin ...@@ -779,34 +794,33 @@ begin
); );
end; end;
procedure TFOrderEntryCorrugated.btnCancelClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnCancelClick(Sender: TObject);
begin begin
document.getElementById('modal_body').innerHTML := 'Are you sure you want to cancel all changes?'; ShowConfirmationModal(
document.getElementById('btn_confirm_cancel').innerText := 'No'; 'Are you sure you want to cancel all changes?',
document.getElementById('btn_confirm_delete').innerText := 'Yes'; 'Yes',
asm 'No',
var modal = document.getElementById('confirmation_modal'); procedure(confirmed: Boolean)
// ensure the modal is directly under <body> begin
if (modal && modal.parentNode !== document.body) { if confirmed then
document.body.appendChild(modal); begin
} FViewMain.change := false;
if OrderID <> '' then
var bsModal = new bootstrap.Modal(modal, { FViewMain.ViewOrderEntryCorrugated(OrderID, '', 'EDIT', 'Failure: Changes Discarded')
keyboard: false else
}); FViewMain.ViewOrders('');
bsModal.show(); end;
end; end
);
end; end;
procedure TFOrderEntryCorrugated.btnCloseClick(Sender: TObject); procedure TFOrderEntryCorrugated.btnCloseClick(Sender: TObject);
begin begin
FViewMain.ViewOrders(''); FViewMain.ViewOrders('');
end; end;
procedure TFOrderEntryCorrugated.btnCloseNotificationClick(Sender: TObject);
begin
hideNotification();
end;
procedure TFOrderEntryCorrugated.WebFormCreate(Sender: TObject); procedure TFOrderEntryCorrugated.WebFormCreate(Sender: TObject);
begin begin
...@@ -817,6 +831,7 @@ begin ...@@ -817,6 +831,7 @@ begin
end; end;
end; end;
procedure TFOrderEntryCorrugated.getOrder(Order_ID: string); procedure TFOrderEntryCorrugated.getOrder(Order_ID: string);
// retrieves an order from the server then loads the info into the page // retrieves an order from the server then loads the info into the page
var var
...@@ -835,141 +850,147 @@ var ...@@ -835,141 +850,147 @@ var
colorListJSON: TJSONArray; colorListJSON: TJSONArray;
items: TJSObject; items: TJSObject;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder', try
[Order_ID])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrder', [Order_ID]));
order := TJSObject(xdcResponse.Result); order := TJSObject(xdcResponse.Result);
data := TJSArray(order['data']); data := TJSArray(order['data']);
XDataWebDataSet1.Close; XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(order); XDataWebDataSet1.SetJsonData(order);
XDataWebDataSet1.Open; XDataWebDataSet1.Open;
if XDataWebDataSet1colors_colors.Value <> '' then XDataWebDataSet1.Edit;
begin
colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors_colors.Value)); if XDataWebDataSet1colors_colors.Value <> '' then
colorList := TJSArray(colorObject['items']);
for I := 0 to colorList.length -1 do
begin begin
color := TJSObject(colorList[i]); colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1colors_colors.Value));
addColorRow(String(color['#']), string(color['Color']), string(color['LPI']), string(color['Size'])); 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; end;
end;
// Check boxes and dates need to be manually set // Check boxes and dates need to be manually set
if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then
dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value) dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value)
else else
dtpOrderDate.Date := 0; dtpOrderDate.Date := 0;
if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then
dtpProofDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_proof_date.AsString) dtpProofDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_proof_date.AsString)
else else
dtpProofDate.Date := 0; dtpProofDate.Date := 0;
if not (XDataWebDataSet1staff_fields_ship_date.AsString = '') then if not (XDataWebDataSet1staff_fields_ship_date.AsString = '') then
dtpShipDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_ship_date.AsString) dtpShipDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_ship_date.AsString)
else else
dtpShipDate.Date := 0; dtpShipDate.Date := 0;
if not (XDataWebDataSet1staff_fields_art_due.AsString = '') then if not (XDataWebDataSet1staff_fields_art_due.AsString = '') then
dtpArtDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_art_due.AsString) dtpArtDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_art_due.AsString)
else else
dtpArtDue.Date := 0; dtpArtDue.Date := 0;
if not (XDataWebDataSet1staff_fields_plate_due.AsString = '') then if not (XDataWebDataSet1staff_fields_plate_due.AsString = '') then
dtpPlateDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_plate_due.AsString) dtpPlateDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_plate_due.AsString)
else else
dtpPlateDue.Date := 0; dtpPlateDue.Date := 0;
if not (XDataWebDataSet1staff_fields_mount_due.AsString = '') then if not (XDataWebDataSet1staff_fields_mount_due.AsString = '') then
dtpMountDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_mount_due.AsString) dtpMountDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_mount_due.AsString)
else else
dtpMountDue.Date := 0; dtpMountDue.Date := 0;
if not (XDataWebDataSet1proofing_approved_date.AsString = '') then if not (XDataWebDataSet1proofing_approved_date.AsString = '') then
dtpApprovedDate.Date := StrToDateTime(XDataWebDataSet1proofing_approved_date.AsString) dtpApprovedDate.Date := StrToDateTime(XDataWebDataSet1proofing_approved_date.AsString)
else else
dtpApprovedDate.Date := 0; dtpApprovedDate.Date := 0;
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;
// Supplied by customers check boxes 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.AsBoolean then // Supplied by customers check boxes
cbColorCopy.Checked := true
else
cbColorCopy.checked := false;
if XDataWebDataSet1supplied_by_customer_ftp.AsString <> '' then if XDataWebDataSet1supplied_by_customer_color_copy.AsBoolean then
begin cbColorCopy.Checked := true
cbFTP.Checked := true; else
end cbColorCopy.checked := false;
else
cbFTP.Checked := false;
if XDataWebDataSet1supplied_by_customer_plates.AsBoolean then if XDataWebDataSet1supplied_by_customer_ftp.AsString <> '' then
cbPlates.Checked := true begin
else cbFTP.Checked := true;
cbPlates.Checked := false; end
else
cbFTP.Checked := false;
if XDataWebDataSet1supplied_by_customer_sample_ca.AsBoolean then if XDataWebDataSet1supplied_by_customer_plates.AsBoolean then
cbSampleCarton.Checked := true cbPlates.Checked := true
else else
cbSampleCarton.Checked := false; cbPlates.Checked := false;
if XDataWebDataSet1supplied_by_customer_e_mail.AsBoolean then if XDataWebDataSet1supplied_by_customer_sample_ca.AsBoolean then
cbEmail.Checked := true cbSampleCarton.Checked := true
else else
cbSampleCarton.Checked := false; cbSampleCarton.Checked := false;
// layout if XDataWebDataSet1supplied_by_customer_e_mail.AsBoolean then
cbEmail.Checked := true
else
cbSampleCarton.Checked := false;
if XDataWebDataSet1layout_excalibur_die.AsBoolean then // layout
cbExcaliburDie.Checked := true
else
cbExcaliburDie.Checked := false;
if XDataWebDataSet1layout_excalibur_die.AsBoolean then
cbExcaliburDie.Checked := true
else
cbExcaliburDie.Checked := false;
// Mounting check boxes
if XDataWebDataSet1mounting_loose.AsString <> '' then
cbLoose.Checked := true
else
cbLoose.Checked := false;
if XDataWebDataSet1mounting_sticky_bak.AsString <> '' then // Mounting check boxes
cbStickyBak.Checked := true if XDataWebDataSet1mounting_loose.AsString <> '' then
else cbLoose.Checked := true
cbStickyBak.Checked := false; else
cbLoose.Checked := false;
if XDataWebDataSet1mounting_full_mount.AsString <> '' then if XDataWebDataSet1mounting_sticky_bak.AsString <> '' then
cbFullMount.Checked := true cbStickyBak.Checked := true
else else
cbFullMount.Checked := false; cbStickyBak.Checked := false;
if XDataWebDataSet1mounting_strip_mount.AsString <> '' then if XDataWebDataSet1mounting_full_mount.AsString <> '' then
cbStripMount.Checked := true cbFullMount.Checked := true
else else
cbStripMount.Checked := false; cbFullMount.Checked := false;
if mode = 'EDIT' then if XDataWebDataSet1mounting_strip_mount.AsString <> '' then
begin cbStripMount.Checked := true
CustomerID := XDataWebDataSet1COMPANY_ID.AsString; else
xdwdsShipTo.Close; cbStripMount.Checked := false;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
xdwdsQBItem.Close; if mode = 'EDIT' then
items := TJSObject(order['ITEMS']); begin
xdwdsQBItem.SetJsonData(items['data']); CustomerID := XDataWebDataSet1COMPANY_ID.AsString;
xdwdsQBITEM.Open; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
xdwdsQBItem.Close;
items := TJSObject(order['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open;
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve order: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
procedure TFOrderEntryCorrugated.getCustomer(customerID: string); procedure TFOrderEntryCorrugated.getCustomer(customerID: string);
// gets a customer from the database then loads the appropiate fields // gets a customer from the database then loads the appropiate fields
var var
...@@ -978,105 +999,37 @@ var ...@@ -978,105 +999,37 @@ var
address: string; address: string;
items: TJSObject; items: TJSObject;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer', try
[customerID])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCustomer', [customerID]));
customer := TJSObject(xdcResponse.Result); customer := TJSObject(xdcResponse.Result);
XDataWebDataSet1.Close; XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(customer); XDataWebDataSet1.SetJsonData(customer);
XDataWebDataSet1.Open; XDataWebDataSet1.Open;
XDataWebDataSet1.Edit;
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(customer['ADDRESS_LIST']);
xdwdsShipTo.Open;
xdwdsShipTo.Close; xdwdsQBItem.Close;
xdwdsShipTo.SetJSONData(customer['ADDRESS_LIST']); items := TJSObject(customer['ITEMS']);
xdwdsShipTo.Open; xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open;
xdwdsQBItem.Close;
items := TJSObject(customer['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open;
dtpOrderDate.Date := 0; dtpOrderDate.Date := 0;
dtpProofDate.Date := 0; dtpProofDate.Date := 0;
dtpArtDue.Date := 0; dtpArtDue.Date := 0;
dtpPlateDue.Date := 0; dtpPlateDue.Date := 0;
dtpMountDue.Date := 0; dtpMountDue.Date := 0;
dtpShipDate.Date := 0; dtpShipDate.Date := 0;
dtpApprovedDate.Date := 0; dtpApprovedDate.Date := 0;
end; except
on E: EXDataClientRequestException do
procedure TFOrderEntryCorrugated.WebFormShow(Sender: TObject); Utils.ShowErrorModal('Could not retrieve customer: ' + E.ErrorResult.ErrorMessage);
begin
if mode <> 'ADD' then
begin
getOrder(orderID);
ViewMode();
end
else
begin
getCustomer(customerID);
EditMode();
end;
edtOrderNum.Text := OrderID;
if notification = '' then
begin
HideNotification;
end
else
begin
ShowNotification(notification);
end; end;
end; end;
procedure TFOrderEntryCorrugated.XDataWebDataSet1AfterEdit(DataSet: TDataSet);
begin
EditMode();
end;
procedure TFOrderEntryCorrugated.xdwdsQBItemAfterEdit(DataSet: TDataSet);
begin
EditMode();
end;
procedure TFOrderEntryCorrugated.xdwdsShipToAfterEdit(DataSet: TDataSet);
begin
EditMode();
end;
procedure TFOrderEntryCorrugated.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFOrderEntryCorrugated.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
console.log(notification);
if Notification <> '' then
begin
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
console.log(splitNotification[1]) ;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end;
procedure TFOrderEntryCorrugated.tmrReturnTimer(Sender: TObject); procedure TFOrderEntryCorrugated.tmrReturnTimer(Sender: TObject);
...@@ -1086,14 +1039,10 @@ begin ...@@ -1086,14 +1039,10 @@ begin
FViewMain.ViewOrders('Success: Order Successfully Deleted'); FViewMain.ViewOrders('Success: Order Successfully Deleted');
end; end;
procedure TFOrderEntryCorrugated.tmrScrollTopTimer(Sender: TObject);
begin
tmrScrollTop.Enabled := False;
window.scrollTo(0, 0);
end;
procedure TFOrderEntryCorrugated.EditMode(); procedure TFOrderEntryCorrugated.EditMode();
begin begin
XDataWebDataSet1.Edit;
FViewMain.change := true; FViewMain.change := true;
btnCopy.Enabled := false; btnCopy.Enabled := false;
btnPDF.Enabled := false; btnPDF.Enabled := false;
...@@ -1103,37 +1052,32 @@ begin ...@@ -1103,37 +1052,32 @@ begin
btnCancel.Enabled := True; btnCancel.Enabled := True;
btnEdit.Enabled := false; btnEdit.Enabled := false;
btnAdd.Enabled := false; btnAdd.Enabled := false;
end;
procedure TFOrderEntryCorrugated.dtpApprovedDateChange(Sender: TObject);
begin
EditMode();
end;
procedure TFOrderEntryCorrugated.dtpMountDueChange(Sender: TObject); // Enable all non-DB checkboxes manually
begin cbRefArtAPDF.Enabled := True;
EditMode(); cbRefArtPrintCard.Enabled := True;
cbExistingCuttingDie.Enabled := True;
cbFTP.Enabled := True;
cbSampleCarton.Enabled := True;
cbPlates.Enabled := True;
cbColorCopy.Enabled := True;
cbStripMount.Enabled := True;
cbFullMount.Enabled := True;
cbStickyBak.Enabled := True;
cbLoose.Enabled := True;
cbExcaliburDie.Enabled := True;
cbEmail.Enabled := True;
cbArtApprovedAsIs.Enabled := True;
cbPDFFile.Enabled := True;
cbWideFormat.Enabled := True;
cbPrintCard.Enabled := True;
cbFullSizePanel.Enabled := True;
lblFormState.Caption := 'Edit Mode';
lblFormState.ElementHandle.classList.remove('text-danger');
lblFormState.ElementHandle.classList.add('text-success');
end; end;
procedure TFOrderEntryCorrugated.dtpOrderDateChange(Sender: TObject);
begin
EditMode();
end;
procedure TFOrderEntryCorrugated.dtpPlateDueChange(Sender: TObject);
begin
EditMode();
end;
procedure TFOrderEntryCorrugated.dtpProofDateChange(Sender: TObject);
begin
EditMode();
end;
procedure TFOrderEntryCorrugated.dtpShipDateChange(Sender: TObject);
begin
EditMode();
end;
procedure TFOrderEntryCorrugated.ViewMode; procedure TFOrderEntryCorrugated.ViewMode;
begin begin
...@@ -1146,10 +1090,36 @@ begin ...@@ -1146,10 +1090,36 @@ begin
btnEdit.Enabled := true; btnEdit.Enabled := true;
btnAdd.Enabled := true; btnAdd.Enabled := true;
FViewMain.change := false; FViewMain.change := false;
// Explicitly disable all non-DB checkboxes
cbRefArtAPDF.Enabled := False;
cbRefArtPrintCard.Enabled := False;
cbExistingCuttingDie.Enabled := False;
cbFTP.Enabled := False;
cbSampleCarton.Enabled := False;
cbPlates.Enabled := False;
cbColorCopy.Enabled := False;
cbStripMount.Enabled := False;
cbFullMount.Enabled := False;
cbStickyBak.Enabled := False;
cbLoose.Enabled := False;
cbExcaliburDie.Enabled := False;
cbEmail.Enabled := False;
cbArtApprovedAsIs.Enabled := False;
cbPDFFile.Enabled := False;
cbWideFormat.Enabled := False;
cbPrintCard.Enabled := False;
cbFullSizePanel.Enabled := False;
lblFormState.Caption := 'View Mode';
lblFormState.ElementHandle.classList.remove('text-success');
lblFormState.ElementHandle.classList.add('text-danger');
end; end;
initialization initialization
RegisterClass(TFOrderEntryCorrugated); RegisterClass(TFOrderEntryCorrugated);
end. end.
object FOrderEntryCuttingDie: TFOrderEntryCuttingDie object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Width = 956 Width = 956
Height = 728 Height = 728
OnShow = WebFormShow
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 26 Left = 26
Top = 72 Top = 72
...@@ -32,6 +31,15 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -32,6 +31,15 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Visible = False Visible = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblFormState: TWebLabel
Left = 34
Top = 8
Width = 3
Height = 15
ElementID = 'lbl_form_state'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object edtCompanyAccountName: TWebDBEdit object edtCompanyAccountName: TWebDBEdit
Left = 24 Left = 24
Top = 120 Top = 120
...@@ -46,10 +54,11 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -46,10 +54,11 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object edtInQuickBooks: TWebDBEdit object edtInQuickBooks: TWebDBEdit
Left = 26 Left = 24
Top = 148 Top = 152
Width = 121 Width = 121
Height = 23 Height = 23
AutoCompletion = acNope
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinquickbooks' ElementID = 'edtinquickbooks'
...@@ -70,7 +79,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -70,7 +79,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpProofDate: TWebDateTimePicker object dtpProofDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -84,7 +92,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -84,7 +92,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpShipDate: TWebDateTimePicker object dtpShipDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -98,7 +105,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -98,7 +105,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtShipVia: TWebDBEdit object edtShipVia: TWebDBEdit
Left = 24 Left = 24
...@@ -120,6 +126,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -120,6 +126,7 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
Height = 23 Height = 23
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
EditType = weNumeric
ElementID = 'edtquantity' ElementID = 'edtquantity'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
...@@ -228,43 +235,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -228,43 +235,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick OnClick = btnCancelClick
end end
object pnlMessage: TWebPanel
Left = 324
Top = 19
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 5
ElementPosition = epRelative
Role = 'alert'
TabOrder = 15
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 46
Height = 15
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'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
end
end
object edtCompanyName: TWebDBEdit object edtCompanyName: TWebDBEdit
Left = 26 Left = 26
Top = 92 Top = 92
...@@ -338,18 +308,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -338,18 +308,6 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCloseClick OnClick = btnCloseClick
end end
object btn_confirm_delete: TWebButton
Left = 776
Top = 279
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object btnCopy: TWebButton object btnCopy: TWebButton
Left = 746 Left = 746
Top = 453 Top = 453
...@@ -399,15 +357,15 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -399,15 +357,15 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
OnClick = WebButton2Click OnClick = WebButton2Click
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
AutoEdit = False
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
Left = 22 Left = 418
Top = 10 Top = 86
end end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 90 Left = 422
Top = 20 Top = 28
object XDataWebDataSet1COMPANY_ID: TIntegerField object XDataWebDataSet1COMPANY_ID: TIntegerField
FieldName = 'COMPANY_ID' FieldName = 'COMPANY_ID'
end end
...@@ -468,40 +426,35 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie ...@@ -468,40 +426,35 @@ object FOrderEntryCuttingDie: TFOrderEntryCuttingDie
object XDataWebDataSet1staff_fields_quantity: TStringField object XDataWebDataSet1staff_fields_quantity: TStringField
FieldName = 'staff_fields_quantity' FieldName = 'staff_fields_quantity'
end end
object XDataWebDataSet1inQuickBooks: TStringField
FieldName = 'inQuickBooks'
end
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 192 Left = 200
Top = 92 Top = 50
end
object tmrScrollTop: TWebTimer
Interval = 100
OnTimer = tmrScrollTopTimer
Left = 240
Top = 8
end end
object wdsShipTo: TWebDataSource object wdsShipTo: TWebDataSource
DataSet = xdwdsShipTo DataSet = xdwdsShipTo
Left = 302 Left = 526
Top = 418 Top = 86
end end
object xdwdsShipTo: TXDataWebDataSet object xdwdsShipTo: TXDataWebDataSet
AfterEdit = xdwdsShipToAfterEdit Left = 528
Left = 288 Top = 26
Top = 370
object xdwdsShipToADDRESS: TStringField object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS' FieldName = 'ADDRESS'
end end
end end
object wdsQBItem: TWebDataSource object wdsQBItem: TWebDataSource
DataSet = xdwdsQBItem DataSet = xdwdsQBItem
Left = 230 Left = 606
Top = 554 Top = 86
end end
object xdwdsQBItem: TXDataWebDataSet object xdwdsQBItem: TXDataWebDataSet
AfterEdit = xdwdsQBItemAfterEdit Left = 608
Left = 190 Top = 30
Top = 548
object xdwdsQBItemname: TStringField object xdwdsQBItemname: TStringField
FieldName = 'name' FieldName = 'name'
end end
......
<nav class="navbar navbar-expand navbar-light bg-light sticky-top" style="z-index: 100;"> <nav class="navbar navbar-expand navbar-light bg-light border-light sticky-top" style="z-index: 100;">
<div class="container-fluid ps-0"> <div class="container-fluid d-flex align-items-center ps-0 pe-0">
<div id="view.login.message" class="alert alert-danger"
style="padding: 0.25rem 0.5rem; font-size: 0.875rem; line-height: 1.5; display: flex; align-items: center; margin: 0 0 0 60px; height: 32px; width: 400px;"> <!-- Left-aligned label -->
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button> <div class="me-auto ps-3">
<span id="view.login.message.label"></span> <label id="lbl_form_state" class="form-label mb-0 fw-bold text-uppercase text-nowrap text-danger" style="font-size: 16px;">View Mode</label>
</div>
<ul class="navbar-nav me-auto ps-2">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btncopy" class="btn btn-primary btn-sm">Copy</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-secondary btn-sm">Close</button>
</li>
</ul>
</div> </div>
<!-- Right-aligned buttons -->
<ul class="navbar-nav ms-auto pe-2 mb-0">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btncopy" class="btn btn-primary btn-sm">Copy</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-primary btn-sm">Close</button>
</li>
</ul>
</div>
</nav> </nav>
<div class="row mx-5"> <div class="row mx-5">
<h4 class="custom-h4 mt-3">Customer</h4> <h4 class="custom-h4 mt-3">Customer</h4>
...@@ -129,26 +132,4 @@ ...@@ -129,26 +132,4 @@
</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">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmation_modal_label">Confirm</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="modal_body">
Are you sure you want to delete this order?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id=btn_confirm_cancel>Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_delete">Delete</button>
</div>
</div>
</div>
</div>
</div>
<style>
.modal-backdrop {
opacity: 0 !important;
}
</style>
unit View.OrderEntryCuttingDie; unit View.OrderEntryCuttingDie;
interface interface
...@@ -7,7 +7,7 @@ uses ...@@ -7,7 +7,7 @@ uses
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage, WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls, ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB; Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, VCL.Forms;
type type
TFOrderEntryCuttingDie = class(TWebForm) TFOrderEntryCuttingDie = class(TWebForm)
...@@ -30,7 +30,6 @@ type ...@@ -30,7 +30,6 @@ type
XDataWebDataSet1staff_fields_proof_date: TStringField; XDataWebDataSet1staff_fields_proof_date: TStringField;
XDataWebDataSet1staff_fields_ship_date: TStringField; XDataWebDataSet1staff_fields_ship_date: TStringField;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
tmrScrollTop: TWebTimer;
WebLabel2: TWebLabel; WebLabel2: TWebLabel;
edtCompanyAccountName: TWebDBEdit; edtCompanyAccountName: TWebDBEdit;
edtInQuickBooks: TWebDBEdit; edtInQuickBooks: TWebDBEdit;
...@@ -52,9 +51,6 @@ type ...@@ -52,9 +51,6 @@ type
edtSpecialInstructions: TWebDBEdit; edtSpecialInstructions: TWebDBEdit;
btnSave: TWebButton; btnSave: TWebButton;
btnCancel: TWebButton; btnCancel: TWebButton;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
edtCompanyName: TWebDBEdit; edtCompanyName: TWebDBEdit;
XDataWebDataSet1NAME: TStringField; XDataWebDataSet1NAME: TStringField;
XDataWebDataSet1staff_fields_quickbooks_item: TStringField; XDataWebDataSet1staff_fields_quickbooks_item: TStringField;
...@@ -68,21 +64,18 @@ type ...@@ -68,21 +64,18 @@ type
edtOrderNum: TWebEdit; edtOrderNum: TWebEdit;
btnDelete: TWebButton; btnDelete: TWebButton;
btnClose: TWebButton; btnClose: TWebButton;
btn_confirm_delete: TWebButton;
btnCopy: TWebButton; btnCopy: TWebButton;
tmrReturn: TWebTimer; tmrReturn: TWebTimer;
btnEdit: TWebButton; btnEdit: TWebButton;
btnAdd: TWebButton; btnAdd: TWebButton;
WebButton2: TWebButton; WebButton2: TWebButton;
XDataWebDataSet1inQuickBooks: TStringField;
lblFormState: TWebLabel;
procedure btnSaveClick(Sender: TObject); procedure btnSaveClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure WebFormShow(Sender: TObject);
[async] procedure GetCuttingDieOrder(Order_ID: string); [async] procedure GetCuttingDieOrder(Order_ID: string);
[async] procedure GetCustomer(customerID: string); [async] procedure GetCustomer(customerID: string);
procedure tmrScrollTopTimer(Sender: TObject);
[async] procedure AddCuttingDieOrder(orderJSON: TJSONObject); [async] procedure AddCuttingDieOrder(orderJSON: TJSONObject);
procedure btnPDFClick(Sender: TObject); procedure btnPDFClick(Sender: TObject);
[async] procedure GenerateReportPDF; [async] procedure GenerateReportPDF;
...@@ -92,14 +85,8 @@ type ...@@ -92,14 +85,8 @@ type
[async] procedure delOrder(); [async] procedure delOrder();
procedure btnCloseClick(Sender: TObject); procedure btnCloseClick(Sender: TObject);
procedure btnCopyClick(Sender: TObject); procedure btnCopyClick(Sender: TObject);
procedure btn_confirm_deleteClick(Sender: TObject);
procedure tmrReturnTimer(Sender: TObject); procedure tmrReturnTimer(Sender: TObject);
procedure btnAddClick(Sender: TObject); procedure btnAddClick(Sender: TObject);
procedure xdwdsShipToAfterEdit(DataSet: TDataSet);
procedure EditMode();
procedure xdwdsQBItemAfterEdit(DataSet: TDataSet);
procedure XDataWebDataSet1AfterEdit(DataSet: TDataSet);
procedure dtpOrderDateChange(Sender: TObject);
procedure btnEditClick(Sender: TObject); procedure btnEditClick(Sender: TObject);
procedure ViewMode(); procedure ViewMode();
procedure WebButton2Click(Sender: TObject); procedure WebButton2Click(Sender: TObject);
...@@ -113,8 +100,10 @@ type ...@@ -113,8 +100,10 @@ type
customerID: string; customerID: string;
mode: string; mode: string;
notification: string; notification: string;
procedure EditMode;
[async] procedure InitializeForm;
public public
class function CreateForm(AElementID, orderInfo, customerInfo, mode, info: string): TWebForm; class function CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
end; end;
var var
...@@ -127,11 +116,52 @@ implementation ...@@ -127,11 +116,52 @@ implementation
uses uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils; View.Home, View.Main, View.AddOrder, View.AddAddress, Utils;
class function TFOrderEntryCuttingDie.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
begin
Application.CreateForm(TFOrderEntryCuttingDie, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntryCuttingDie(AForm) do
begin
customerID := customerInfo;
orderID := orderInfo;
mode := modeParam;
notification := info;
console.log('Mode in createform: ' + modeParam);
InitializeForm;
end;
end
);
end;
[async] procedure TFOrderEntryCuttingDie.InitializeForm;
begin
console.log('The mode in initialize form is: ' + mode);
if mode = 'ADD' then
begin
await(getCustomer(customerID));
EditMode;
end
else
begin
await(getCuttingDieOrder(orderID));
ViewMode;
end;
edtOrderNum.Text := orderID;
if notification <> '' then
ShowToast(notification);
end;
procedure TFOrderEntryCuttingDie.WebButton2Click(Sender: TObject); procedure TFOrderEntryCuttingDie.WebButton2Click(Sender: TObject);
begin begin
ShowAddAddressForm(); ShowAddAddressForm();
end; end;
procedure TFOrderEntryCuttingDie.SendAddressToServer(AddressJSON: TJSONObject); procedure TFOrderEntryCuttingDie.SendAddressToServer(AddressJSON: TJSONObject);
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
...@@ -141,12 +171,13 @@ begin ...@@ -141,12 +171,13 @@ begin
[AddressJSON.ToString])); [AddressJSON.ToString]));
notification := TJSObject(Response.Result); notification := TJSObject(Response.Result);
ShowNotification(string(notification['status'])); ShowToast(string(notification['status']));
xdwdsShipTo.Close; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(notification['ADDRESS']); xdwdsShipTo.SetJSONData(notification['ADDRESS']);
xdwdsShipTo.Open; xdwdsShipTo.Open;
end; end;
procedure TFOrderEntryCuttingDie.ShowAddAddressForm; procedure TFOrderEntryCuttingDie.ShowAddAddressForm;
// displays the search pop-up that allows the user to filter the order list // displays the search pop-up that allows the user to filter the order list
var var
...@@ -159,6 +190,7 @@ begin ...@@ -159,6 +190,7 @@ begin
newform.Caption := 'Shipping Information'; newform.Caption := 'Shipping Information';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
window.location.hash := 'subform'; window.location.hash := 'subform';
...@@ -193,6 +225,7 @@ begin ...@@ -193,6 +225,7 @@ begin
); );
end; end;
function TFOrderEntryCuttingDie.VerifyOrder: Boolean; function TFOrderEntryCuttingDie.VerifyOrder: Boolean;
var var
input: TJSHTMLInputElement; input: TJSHTMLInputElement;
...@@ -249,6 +282,7 @@ begin ...@@ -249,6 +282,7 @@ begin
input.classList.remove('is-invalid'); input.classList.remove('is-invalid');
end; end;
procedure TFOrderEntryCuttingDie.SendOrderToServer; procedure TFOrderEntryCuttingDie.SendOrderToServer;
var var
orderJSON: TJSONObject; orderJSON: TJSONObject;
...@@ -296,14 +330,14 @@ begin ...@@ -296,14 +330,14 @@ begin
orderJSON.AddPair('ORDER_ID', orderID); orderJSON.AddPair('ORDER_ID', orderID);
if mode = 'ADD' then if mode = 'ADD' then
ShowNotification('Success:Order Added Successfully!') ShowToast('Success: Order Added Successfully!')
else else
ShowNotification('Success:Order Edited Successfully'); ShowToast('Success: Order Edited Successfully');
AddCuttingDieOrder(orderJSON); AddCuttingDieOrder(orderJSON);
end; end;
procedure TFOrderEntryCuttingDie.btnSaveClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnSaveClick(Sender: TObject);
// Converts all the information on the page into a JSON to then send to the server // Converts all the information on the page into a JSON to then send to the server
begin begin
...@@ -315,81 +349,57 @@ begin ...@@ -315,81 +349,57 @@ begin
window.scrollTo(0, 0); window.scrollTo(0, 0);
end; end;
procedure TFOrderEntryCuttingDie.btnCopyClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnCopyClick(Sender: TObject);
begin begin
mode := 'ADD'; mode := 'ADD';
dtpOrderDate.Date := 0; dtpOrderDate.Date := 0;
dtpProofDate.Date := 0; dtpProofDate.Date := 0;
edtOrderNum.Text := ''; edtOrderNum.Text := '';
ShowNotification('Success:Order Successfully Copied'); ShowToast('Success: Order Successfully Copied');
EditMode(); EditMode();
window.scrollTo(0, 0); window.scrollTo(0, 0);
end; end;
procedure TFOrderEntryCuttingDie.btnDeleteClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnDeleteClick(Sender: TObject);
begin begin
asm ShowConfirmationModal(
var modal = document.getElementById('confirmation_modal'); 'Are you sure you want to delete this order?',
// ensure the modal is directly under <body> 'Delete',
if (modal && modal.parentNode !== document.body) { 'Cancel',
document.body.appendChild(modal); procedure(confirmed: Boolean)
} begin
if confirmed then
var bsModal = new bootstrap.Modal(modal, { begin
keyboard: false Utils.ShowSpinner('spinner');
}); DelOrder();
bsModal.show(); tmrReturn.Enabled := true;
end; end;
end
);
end; end;
procedure TFOrderEntryCuttingDie.btnEditClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnEditClick(Sender: TObject);
begin begin
EditMode(); EditMode;
end; end;
procedure TFOrderEntryCuttingDie.DelOrder(); procedure TFOrderEntryCuttingDie.DelOrder();
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
begin begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelOrder', Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelOrder', [OrderID, 'cutting', JS.toString(AuthService.TokenPayload.Properties['user_id'])]));
[OrderID, 'corrugated', JS.toString(AuthService.TokenPayload.Properties['user_id'])]));
end; end;
procedure TFOrderEntryCuttingDie.btnPDFClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnPDFClick(Sender: TObject);
begin begin
GenerateReportPDF; GenerateReportPDF;
end; end;
procedure TFOrderEntryCuttingDie.btn_confirm_deleteClick(Sender: TObject);
begin
if document.getElementById('btn_confirm_delete').innerText = 'Yes' then
begin
FViewMain.change := false;
if OrderID <> '' then
begin
FViewMain.ViewOrderEntryCuttingDie(OrderID, '', 'EDIT', 'Failure:Changes Discarded');
end
else
FViewMain.ViewOrders('');
end
else
begin
Utils.ShowSpinner('spinner');
asm
var modal = document.getElementById('confirmation_modal');
// ensure the modal lives directly under <body>
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
var bsModal = new bootstrap.Modal(modal, {
keyboard: false
});
bsModal.hide();
end;
delOrder();
tmrReturn.Enabled := true;
end;
end;
[async] procedure TFOrderEntryCuttingDie.GenerateReportPDF; [async] procedure TFOrderEntryCuttingDie.GenerateReportPDF;
// sends the search to the server which then sends back a pdf of the results // sends the search to the server which then sends back a pdf of the results
...@@ -398,52 +408,43 @@ var ...@@ -398,52 +408,43 @@ var
searchOptions, pdfURL: string; searchOptions, pdfURL: string;
jsObject: TJSObject; jsObject: TJSObject;
begin begin
try
// Call the server method to generate the PDF // Call the server method to generate the PDF
console.log(orderID); console.log(orderID);
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderCuttingPDF', [orderID])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderCuttingPDF', [orderID]));
jsObject := JS.TJSObject(xdcResponse.Result); jsObject := JS.TJSObject(xdcResponse.Result);
pdfURL := JS.toString(jsObject.Properties['value']); pdfURL := JS.toString(jsObject.Properties['value']);
// Open the PDF in a new browser tab without needing a different form // Open the PDF in a new browser tab without needing a different form
// This method is much faster too, even for large datasets // This method is much faster too, even for large datasets
window.open(pdfURL, '_blank'); window.open(pdfURL, '_blank');
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not generate cutting die PDF: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
procedure TFOrderEntryCuttingDie.AddCuttingDieOrder(orderJSON: TJSONObject); procedure TFOrderEntryCuttingDie.AddCuttingDieOrder(orderJSON: TJSONObject);
// sends the order JSON object to the server // sends the order JSON object to the server
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
jsObj: TJSObject; jsObj: TJSObject;
begin begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCuttingDieOrder', try
[orderJSON.ToString])); Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddCuttingDieOrder',
jsObj := JS.TJSObject(Response.Result); [orderJSON.ToString]));
if mode = 'ADD' then jsObj := JS.TJSObject(Response.Result);
OrderID := String(jsObj.Properties['OrderID']); if mode = 'ADD' then
mode := 'EDIT'; OrderID := String(jsObj.Properties['OrderID']);
edtOrderNum.Text := OrderID;
mode := 'EDIT';
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not save cutting die order: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
class function TFOrderEntryCuttingDie.CreateForm(AElementID, orderInfo, customerInfo, mode, info: string): TWebForm;
var
localMode: string;
begin
localMode := mode;
Application.CreateForm(TFOrderEntryCuttingDie, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntryCuttingDie(AForm) do
begin
HideNotification;
TFOrderEntryCuttingDie(AForm).customerID := customerInfo;
TFOrderEntryCuttingDie(AForm).orderID := orderInfo;
TFOrderEntryCuttingDie(AForm).mode := localMode;
TFOrderEntryCuttingDie(AForm).notification := info;
end;
end
);
end;
procedure TFOrderEntryCuttingDie.btnAddClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnAddClick(Sender: TObject);
var var
...@@ -455,6 +456,7 @@ begin ...@@ -455,6 +456,7 @@ begin
newform.Caption := 'Select Customer and Order Type'; newform.Caption := 'Select Customer and Order Type';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
window.location.hash := 'subform'; window.location.hash := 'subform';
...@@ -482,25 +484,28 @@ begin ...@@ -482,25 +484,28 @@ begin
); );
end; end;
procedure TFOrderEntryCuttingDie.btnCancelClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnCancelClick(Sender: TObject);
begin begin
document.getElementById('modal_body').innerHTML := 'Are you sure you want to cancel all changes?'; ShowConfirmationModal(
document.getElementById('btn_confirm_cancel').innerText := 'No'; 'Are you sure you want to cancel all changes?',
document.getElementById('btn_confirm_delete').innerText := 'Yes'; 'Yes',
asm 'No',
var modal = document.getElementById('confirmation_modal'); procedure(confirmed: Boolean)
// ensure the modal is directly under <body> begin
if (modal && modal.parentNode !== document.body) { if confirmed then
document.body.appendChild(modal); begin
} FViewMain.change := false;
if OrderID <> '' then
var bsModal = new bootstrap.Modal(modal, { FViewMain.ViewOrderEntryCuttingDie(OrderID, '', 'EDIT', 'Failure: Changes Discarded')
keyboard: false else
}); FViewMain.ViewOrders('');
bsModal.show(); end;
end; end
);
end; end;
procedure TFOrderEntryCuttingDie.btnCloseClick(Sender: TObject); procedure TFOrderEntryCuttingDie.btnCloseClick(Sender: TObject);
begin begin
FViewMain.ViewOrders(''); FViewMain.ViewOrders('');
...@@ -508,13 +513,11 @@ end; ...@@ -508,13 +513,11 @@ end;
procedure TFOrderEntryCuttingDie.WebFormCreate(Sender: TObject); procedure TFOrderEntryCuttingDie.WebFormCreate(Sender: TObject);
begin begin
if not DMConnection.ApiConnection.Connected then if not DMConnection.ApiConnection.Connected then
begin
DMConnection.ApiConnection.OpenAsync; DMConnection.ApiConnection.OpenAsync;
console.log('report requirements connection open')
end;
end; end;
procedure TFOrderEntryCuttingDie.getCuttingDieOrder(Order_ID: string); procedure TFOrderEntryCuttingDie.getCuttingDieOrder(Order_ID: string);
// retrieves an order from the server then loads the info into the page // retrieves an order from the server then loads the info into the page
var var
...@@ -524,50 +527,57 @@ var ...@@ -524,50 +527,57 @@ var
data: TJSArray; data: TJSArray;
order, items: TJSObject; order, items: TJSObject;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCuttingDieOrder', Utils.ShowSpinner('spinner');
[Order_ID])); try
order := TJSObject(xdcResponse.Result); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetCuttingDieOrder',
data := TJSArray(order['data']); [Order_ID]));
XDataWebDataSet1.Close; order := TJSObject(xdcResponse.Result);
XDataWebDataSet1.SetJsonData(order); data := TJSArray(order['data']);
XDataWebDataSet1.Open; XDataWebDataSet1.Close;
XDataWebDataSet1.SetJsonData(order);
XDataWebDataSet1.Open;
// Check boxes and dates need to be manually set
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;
// Check boxes and dates need to be manually set console.log(mode);
console.log(XDataWebDataSet1COMPANY_ID.AsString);
if mode = 'EDIT' then
CustomerID := XDataWebDataSet1COMPANY_ID.AsString;
console.log(CustomerID);
if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then if mode = 'EDIT' then
dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value) begin
else CustomerID := XDataWebDataSet1COMPANY_ID.AsString;
dtpOrderDate.Date := 0; xdwdsShipTo.Close;
if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
dtpProofDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_proof_date.AsString) xdwdsShipTo.Open;
else end;
dtpProofDate.Date := 0;
if not (XDataWebDataSet1staff_fields_ship_date.AsString = '') then
dtpShipDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_ship_date.AsString)
else
dtpShipDate.Date := 0;
console.log(mode); xdwdsQBItem.Close;
console.log(XDataWebDataSet1COMPANY_ID.AsString); items := TJSObject(order['ITEMS']);
if mode = 'EDIT' then xdwdsQBItem.SetJsonData(items['data']);
CustomerID := XDataWebDataSet1COMPANY_ID.AsString; xdwdsQBITEM.Open;
console.log(CustomerID);
if mode = 'EDIT' then except
begin on E: EXDataClientRequestException do
CustomerID := XDataWebDataSet1COMPANY_ID.AsString; Utils.ShowErrorModal('Could not retrieve order: ' + E.ErrorResult.ErrorMessage);
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
xdwdsShipTo.Open;
end; end;
Utils.HideSpinner('spinner');
xdwdsQBItem.Close;
items := TJSObject(order['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open;
end; end;
procedure TFOrderEntryCuttingDie.getCustomer(customerID: string); procedure TFOrderEntryCuttingDie.getCustomer(customerID: string);
// gets a customer from the database then loads the appropiate fields // gets a customer from the database then loads the appropiate fields
var var
...@@ -598,63 +608,6 @@ begin ...@@ -598,63 +608,6 @@ begin
items := TJSObject(customer['ITEMS']); items := TJSObject(customer['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']); xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open; xdwdsQBITEM.Open;
end;
procedure TFOrderEntryCuttingDie.WebFormShow(Sender: TObject);
begin
if mode <> 'ADD' then
begin
getCuttingDieOrder(orderID);
ViewMode();
end
else
begin
getCustomer(customerID);
EditMode();
end;
edtOrderNum.Text := OrderID;
if notification = '' then
begin
HideNotification;
end
else
begin
ShowNotification(notification);
end;
end;
procedure TFOrderEntryCuttingDie.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFOrderEntryCuttingDie.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end; end;
...@@ -665,14 +618,10 @@ begin ...@@ -665,14 +618,10 @@ begin
FViewMain.ViewOrders('Success: Order Successfully Deleted'); FViewMain.ViewOrders('Success: Order Successfully Deleted');
end; end;
procedure TFOrderEntryCuttingDie.tmrScrollTopTimer(Sender: TObject);
begin
tmrScrollTop.Enabled := False;
window.scrollTo(0, 0);
end;
procedure TFOrderEntryCuttingDie.EditMode; procedure TFOrderEntryCuttingDie.EditMode;
begin begin
XDataWebDataSet1.Edit;
FViewMain.change := true; FViewMain.change := true;
btnCopy.Enabled := false; btnCopy.Enabled := false;
btnPDF.Enabled := false; btnPDF.Enabled := false;
...@@ -682,27 +631,12 @@ begin ...@@ -682,27 +631,12 @@ begin
btnCancel.Enabled := True; btnCancel.Enabled := True;
btnEdit.Enabled := false; btnEdit.Enabled := false;
btnAdd.Enabled := false; btnAdd.Enabled := false;
end;
procedure TFOrderEntryCuttingDie.xdwdsQBItemAfterEdit(DataSet: TDataSet); lblFormState.Caption := 'Edit Mode';
begin lblFormState.ElementHandle.classList.remove('text-danger');
EditMode(); lblFormState.ElementHandle.classList.add('text-success');
end; end;
procedure TFOrderEntryCuttingDie.xdwdsShipToAfterEdit(DataSet: TDataSet);
begin
EditMode();
end;
procedure TFOrderEntryCuttingDie.XDataWebDataSet1AfterEdit(DataSet: TDataSet);
begin
EditMode();
end;
procedure TFOrderEntryCuttingDie.dtpOrderDateChange(Sender: TObject);
begin
EditMode();
end;
procedure TFOrderEntryCuttingDie.ViewMode; procedure TFOrderEntryCuttingDie.ViewMode;
begin begin
...@@ -715,8 +649,13 @@ begin ...@@ -715,8 +649,13 @@ begin
btnEdit.Enabled := true; btnEdit.Enabled := true;
btnAdd.Enabled := true; btnAdd.Enabled := true;
FViewMain.change := false; FViewMain.change := false;
lblFormState.Caption := 'View Mode';
lblFormState.ElementHandle.classList.remove('text-success');
lblFormState.ElementHandle.classList.add('text-danger');
end; end;
initialization initialization
RegisterClass(TFOrderEntryCuttingDie); RegisterClass(TFOrderEntryCuttingDie);
......
object FOrderEntryWeb: TFOrderEntryWeb object FOrderEntryWeb: TFOrderEntryWeb
Width = 1261 Width = 1261
Height = 628 Height = 628
OnShow = WebFormShow OnCreate = WebFormCreate
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 26 Left = 26
Top = 72 Top = 72
...@@ -112,54 +112,27 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -112,54 +112,27 @@ object FOrderEntryWeb: TFOrderEntryWeb
Visible = False Visible = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object pnlMessage: TWebPanel object lblFormState: TWebLabel
Left = 324 Left = 18
Top = 19 Top = 16
Width = 121 Width = 3
Height = 33 Height = 15
ElementID = 'view.login.message' ElementID = 'lbl_form_state'
ChildOrder = 5 HeightPercent = 100.000000000000000000
ElementPosition = epRelative WidthPercent = 100.000000000000000000
Role = 'alert'
TabOrder = 0
object lblMessage: TWebLabel
Left = 28
Top = 9
Width = 46
Height = 15
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'
ElementFont = efCSS
ElementPosition = epRelative
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
Role = 'button'
WidthStyle = ssAuto
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end end
object edtCompanyName: TWebDBEdit object edtCompanyName: TWebDBEdit
Left = 24 Left = 24
Top = 92 Top = 92
Width = 260 Width = 260
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcompanyname' ElementID = 'edtcompanyname'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
MaxLength = 90 MaxLength = 90
ShowFocus = False
WidthStyle = ssAuto WidthStyle = ssAuto
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'NAME' DataField = 'NAME'
...@@ -170,10 +143,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -170,10 +143,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 120 Top = 120
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtaccountcompanyname' ElementID = 'edtaccountcompanyname'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'SHORT_NAME' DataField = 'SHORT_NAME'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -183,17 +158,19 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -183,17 +158,19 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 148 Top = 148
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinquickbooks' ElementID = 'edtinquickbooks'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'inQuickBooks' DataField = 'inQuickBooks'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object dtpOrderDate: TWebDateTimePicker object dtpOrderDate: TWebDateTimePicker
Left = 22 Left = 24
Top = 218 Top = 215
Width = 170 Width = 170
Height = 22 Height = 22
ElementID = 'dtporderdate' ElementID = 'dtporderdate'
...@@ -202,8 +179,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -202,8 +179,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpProofDate: TWebDateTimePicker object dtpProofDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -216,8 +194,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -216,8 +194,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpShipDate: TWebDateTimePicker object dtpShipDate: TWebDateTimePicker
Left = 22 Left = 22
...@@ -230,8 +209,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -230,8 +209,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpArtDue: TWebDateTimePicker object dtpArtDue: TWebDateTimePicker
Left = 24 Left = 24
...@@ -244,8 +224,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -244,8 +224,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpPlateDue: TWebDateTimePicker object dtpPlateDue: TWebDateTimePicker
Left = 24 Left = 24
...@@ -258,43 +239,50 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -258,43 +239,50 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtShipVia: TWebDBEdit object edtShipVia: TWebDBEdit
Left = 24 Left = 24
Top = 314 Top = 314
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtshipvia' ElementID = 'edtshipvia'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'staff_fields_ship_via' DataField = 'staff_fields_ship_via'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object edtQuantity: TWebDBEdit object edtQuantity: TWebDBEdit
Left = 24 Left = 24
Top = 346 Top = 345
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtquantity' ElementID = 'edtquantity'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'staff_fields_quantity' DataField = 'staff_fields_quantity'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object edtPrice: TWebDBEdit object edtPrice: TWebDBEdit
Left = 24 Left = 26
Top = 374 Top = 374
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtprice' ElementID = 'edtprice'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'staff_fields_price' DataField = 'staff_fields_price'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -304,10 +292,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -304,10 +292,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 402 Top = 402
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinvoiceto' ElementID = 'edtinvoiceto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'staff_fields_invoice_to' DataField = 'staff_fields_invoice_to'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -317,34 +307,40 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -317,34 +307,40 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 458 Top = 458
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtponumber' ElementID = 'edtponumber'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'staff_fields_po_number' DataField = 'staff_fields_po_number'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object edtJobName: TWebDBEdit object edtJobName: TWebDBEdit
Left = 26 Left = 30
Top = 486 Top = 487
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtjobname' ElementID = 'edtjobname'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'staff_fields_job_name' DataField = 'staff_fields_job_name'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object WebDBComboBox1: TWebDBComboBox object WebDBComboBox1: TWebDBComboBox
Left = 26 Left = 26
Top = 430 Top = 429
Width = 145 Width = 145
Height = 23 Height = 23
ElementID = 'wcbshipto' ElementID = 'wcbshipto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
DataField = 'staff_fields_ship_to' DataField = 'staff_fields_ship_to'
...@@ -357,10 +353,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -357,10 +353,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 214 Top = 214
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtbworcolorcopy' ElementID = 'edtbworcolorcopy'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_b_w_or_co' DataField = 'supplied_by_customer_b_w_or_co'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -370,23 +368,27 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -370,23 +368,27 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 243 Top = 243
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtplates' ElementID = 'edtplates'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_plates' DataField = 'supplied_by_customer_plates'
DataSource = WebDataSource1 DataSource = WebDataSource1
end end
object edtDimensionalLayout: TWebDBEdit object edtDimensionalLayout: TWebDBEdit
Left = 276 Left = 276
Top = 314 Top = 311
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtdimensionallayout' ElementID = 'edtdimensionallayout'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_dimension' DataField = 'supplied_by_customer_dimension'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -396,10 +398,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -396,10 +398,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 281 Top = 281
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtsample' ElementID = 'edtsample'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_sample' DataField = 'supplied_by_customer_sample'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -409,10 +413,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -409,10 +413,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 346 Top = 346
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtother' ElementID = 'edtother'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_other' DataField = 'supplied_by_customer_other'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -422,10 +428,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -422,10 +428,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 379 Top = 379
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtemail' ElementID = 'edtemail'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_e_mail' DataField = 'supplied_by_customer_e_mail'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -435,10 +443,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -435,10 +443,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 442 Top = 442
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edttotalinchesused' ElementID = 'edttotalinchesused'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_total_inc' DataField = 'supplied_by_customer_total_inc'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -448,10 +458,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -448,10 +458,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 408 Top = 408
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtftp' ElementID = 'edtftp'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_ftp' DataField = 'supplied_by_customer_ftp'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -461,10 +473,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -461,10 +473,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 471 Top = 471
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtsheetsused' ElementID = 'edtsheetsused'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_sheets_us' DataField = 'supplied_by_customer_sheets_us'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -474,10 +488,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -474,10 +488,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 504 Top = 504
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinitials' ElementID = 'edtinitials'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_initials' DataField = 'supplied_by_customer_initials'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -487,10 +503,13 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -487,10 +503,13 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 96 Top = 96
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'PDF' Caption = 'PDF'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbpdf' ElementID = 'cbpdf'
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf' DataField = 'proofing_pdf'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -500,10 +519,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -500,10 +519,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 128 Top = 128
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtpdfto' ElementID = 'edtpdfto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf_to' DataField = 'proofing_pdf_to'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -519,8 +540,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -519,8 +540,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpPDFDate3: TWebDateTimePicker object dtpPDFDate3: TWebDateTimePicker
Left = 444 Left = 444
...@@ -533,8 +555,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -533,8 +555,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpPDFDate2: TWebDateTimePicker object dtpPDFDate2: TWebDateTimePicker
Left = 444 Left = 444
...@@ -547,18 +570,22 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -547,18 +570,22 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object cbInkJet: TWebDBCheckBox object cbInkJet: TWebDBCheckBox
Left = 444 Left = 444
Top = 238 Top = 238
Width = 113 Width = 113
Height = 22 Height = 22
TabStop = False
Caption = 'Full Size Ink Jet For Layout Content Only' Caption = 'Full Size Ink Jet For Layout Content Only'
ChildOrder = 79 ChildOrder = 79
ElementID = 'cbfullsizeinkjet' ElementID = 'cbfullsizeinkjet'
Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_full_size_ink_jet_for' DataField = 'proofing_full_size_ink_jet_for'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -568,10 +595,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -568,10 +595,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 295 Top = 295
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinkjetto2' ElementID = 'edtinkjetto2'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_ink_jet_to_2' DataField = 'proofing_ink_jet_to_2'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -581,10 +610,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -581,10 +610,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 266 Top = 266
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtinkjetto' ElementID = 'edtinkjetto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_ink_jet_to' DataField = 'proofing_ink_jet_to'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -600,8 +631,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -600,8 +631,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpInkJetDate3: TWebDateTimePicker object dtpInkJetDate3: TWebDateTimePicker
Left = 444 Left = 444
...@@ -614,8 +646,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -614,8 +646,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpInkJetDate2: TWebDateTimePicker object dtpInkJetDate2: TWebDateTimePicker
Left = 444 Left = 444
...@@ -628,18 +661,21 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -628,18 +661,21 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtColorContrastTo: TWebDBEdit object edtColorContrastTo: TWebDBEdit
Left = 444 Left = 444
Top = 435 Top = 435
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcolorcontrastto' ElementID = 'edtcolorcontrastto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_color_contrac_to' DataField = 'proofing_color_contrac_to'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -655,8 +691,9 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -655,8 +691,9 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object dtpColorContractDate2: TWebDateTimePicker object dtpColorContractDate2: TWebDateTimePicker
Left = 444 Left = 444
...@@ -669,18 +706,21 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -669,18 +706,21 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtDigitalColorTo: TWebDBEdit object edtDigitalColorTo: TWebDBEdit
Left = 444 Left = 444
Top = 545 Top = 545
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtdigitalcolorto' ElementID = 'edtdigitalcolorto'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_digital_color_to' DataField = 'proofing_digital_color_to'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -690,10 +730,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -690,10 +730,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 516 Top = 516
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtdigitalcolorkey' ElementID = 'edtdigitalcolorkey'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'proofing_digital_color_key' DataField = 'proofing_digital_color_key'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -709,18 +751,21 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -709,18 +751,21 @@ object FOrderEntryWeb: TFOrderEntryWeb
Color = clWhite Color = clWhite
Date = 45638.529943136570000000 Date = 45638.529943136570000000
Role = '' Role = ''
ShowFocus = False
TabStop = False
Text = '' Text = ''
OnChange = dtpOrderDateChange
end end
object edtAniloxInfo: TWebDBEdit object edtAniloxInfo: TWebDBEdit
Left = 634 Left = 634
Top = 58 Top = 58
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtanilaxinfo' ElementID = 'edtanilaxinfo'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'quantity_and_colors_anilox_info' DataField = 'quantity_and_colors_anilox_info'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -730,10 +775,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -730,10 +775,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 29 Top = 29
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtpressname' ElementID = 'edtpressname'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'quantity_and_colors_press_name' DataField = 'quantity_and_colors_press_name'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -743,10 +790,11 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -743,10 +790,11 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 87 Top = 87
Width = 96 Width = 96
Height = 25 Height = 25
Caption = '+' Caption = 'Add Color'
ChildOrder = 59 ChildOrder = 59
ElementID = 'btnaddcolor' ElementID = 'btnaddcolor'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = WebButton1Click OnClick = WebButton1Click
end end
...@@ -755,10 +803,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -755,10 +803,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 139 Top = 139
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtmicrodots' ElementID = 'edtmicrodots'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plate_marks_microdots' DataField = 'plate_marks_microdots'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -768,10 +818,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -768,10 +818,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 168 Top = 168
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtmicrodotscomments' ElementID = 'edtmicrodotscomments'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plate_marks_microdots_comments' DataField = 'plate_marks_microdots_comments'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -781,10 +833,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -781,10 +833,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 239 Top = 239
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcrosshairscomments' ElementID = 'edtcrosshairscomments'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plate_marks_crosshairs_comments' DataField = 'plate_marks_crosshairs_comments'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -794,10 +848,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -794,10 +848,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 206 Top = 206
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcrosshairs' ElementID = 'edtcrosshairs'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plate_marks_crosshairs' DataField = 'plate_marks_crosshairs'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -807,10 +863,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -807,10 +863,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 300 Top = 300
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcolorbarscomments' ElementID = 'edtcolorbarscomments'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plate_marks_color_bars_comments' DataField = 'plate_marks_color_bars_comments'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -820,10 +878,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -820,10 +878,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 271 Top = 271
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcolorbars' ElementID = 'edtcolorbars'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plate_marks_color_bars' DataField = 'plate_marks_color_bars'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -833,10 +893,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -833,10 +893,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 329 Top = 329
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtplateother' ElementID = 'edtplateother'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plate_marks_other' DataField = 'plate_marks_other'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -846,10 +908,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -846,10 +908,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 358 Top = 358
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtplateothercomments' ElementID = 'edtplateothercomments'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plate_marks_other_comments' DataField = 'plate_marks_other_comments'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -859,10 +923,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -859,10 +923,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 29 Top = 29
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtaround' ElementID = 'edtaround'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_around' DataField = 'layout_around'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -872,10 +938,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -872,10 +938,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 58 Top = 58
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtaccross' ElementID = 'edtaccross'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_accross' DataField = 'layout_accross'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -885,10 +953,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -885,10 +953,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 129 Top = 129
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtreverseprint' ElementID = 'edtreverseprint'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_reverse_print' DataField = 'layout_reverse_print'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -898,10 +968,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -898,10 +968,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 96 Top = 96
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtsurfaceprint' ElementID = 'edtsurfaceprint'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_surface_print' DataField = 'layout_surface_print'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -911,10 +983,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -911,10 +983,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 190 Top = 190
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcutoffdimension' ElementID = 'edtcutoffdimension'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_cutoff_dimension' DataField = 'layout_cutoff_dimension'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -924,10 +998,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -924,10 +998,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 161 Top = 161
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcylinderrepeat' ElementID = 'edtcylinderrepeat'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_cylinder_repeat' DataField = 'layout_cylinder_repeat'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -937,10 +1013,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -937,10 +1013,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 219 Top = 219
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtpitch' ElementID = 'edtpitch'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_pitch' DataField = 'layout_pitch'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -950,10 +1028,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -950,10 +1028,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 282 Top = 282
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtbleed' ElementID = 'edtbleed'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_bleed' DataField = 'layout_bleed'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -963,10 +1043,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -963,10 +1043,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 248 Top = 248
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtteeth' ElementID = 'edtteeth'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_teeth' DataField = 'layout_teeth'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -976,10 +1058,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -976,10 +1058,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 311 Top = 311
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcutback' ElementID = 'edtcutback'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_cutback' DataField = 'layout_cutback'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -989,10 +1073,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -989,10 +1073,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 344 Top = 344
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtminimumtrapdimension' ElementID = 'edtminimumtrapdimension'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_minimum_trap_dim' DataField = 'layout_minimum_trap_dim'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1002,10 +1088,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1002,10 +1088,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 373 Top = 373
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtmaximumtrapdimension' ElementID = 'edtmaximumtrapdimension'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'layout_maximum_trap_dim' DataField = 'layout_maximum_trap_dim'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1015,10 +1103,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1015,10 +1103,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 423 Top = 423
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtsize' ElementID = 'edtsize'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'upc_size' DataField = 'upc_size'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1028,10 +1118,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1028,10 +1118,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 452 Top = 452
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtbarwidthreduction' ElementID = 'edtbarwidthreduction'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'upc_bar_width_reduction' DataField = 'upc_bar_width_reduction'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1041,10 +1133,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1041,10 +1133,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 523 Top = 523
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtdistortionamount' ElementID = 'edtdistortionamount'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'upc_distortion_amount' DataField = 'upc_distortion_amount'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1054,10 +1148,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1054,10 +1148,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 490 Top = 490
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtdistortionpercent' ElementID = 'edtdistortionpercent'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'upc_distortion_percent' DataField = 'upc_distortion_percent'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1067,10 +1163,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1067,10 +1163,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 516 Top = 516
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtjobnumber' ElementID = 'edtjobnumber'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'plates_job_number' DataField = 'plates_job_number'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1080,10 +1178,12 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1080,10 +1178,12 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 160 Top = 160
Width = 121 Width = 121
Height = 23 Height = 23
TabStop = False
AutoSize = True AutoSize = True
ChildOrder = 79 ChildOrder = 79
ElementID = 'edtcomments' ElementID = 'edtcomments'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
DataField = 'general_comments' DataField = 'general_comments'
DataSource = WebDataSource1 DataSource = WebDataSource1
...@@ -1097,6 +1197,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1097,6 +1197,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 79 ChildOrder = 79
ElementID = 'btnconfirm' ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnSaveClick OnClick = btnSaveClick
end end
...@@ -1109,6 +1210,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1109,6 +1210,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 79 ChildOrder = 79
ElementID = 'btnpdf' ElementID = 'btnpdf'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnPDFClick OnClick = btnPDFClick
end end
...@@ -1121,6 +1223,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1121,6 +1223,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 79 ChildOrder = 79
ElementID = 'btncancel' ElementID = 'btncancel'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick OnClick = btnCancelClick
end end
...@@ -1131,6 +1234,8 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1131,6 +1234,8 @@ object FOrderEntryWeb: TFOrderEntryWeb
Height = 23 Height = 23
ElementID = 'wcbqbitem' ElementID = 'wcbqbitem'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
DataField = 'staff_fields_quickbooks_item' DataField = 'staff_fields_quickbooks_item'
...@@ -1145,6 +1250,8 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1145,6 +1250,8 @@ object FOrderEntryWeb: TFOrderEntryWeb
Height = 23 Height = 23
ElementID = 'wcbmaterial' ElementID = 'wcbmaterial'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
...@@ -1160,6 +1267,8 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1160,6 +1267,8 @@ object FOrderEntryWeb: TFOrderEntryWeb
Height = 23 Height = 23
ElementID = 'wcbthickness' ElementID = 'wcbthickness'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
...@@ -1178,6 +1287,8 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1178,6 +1287,8 @@ object FOrderEntryWeb: TFOrderEntryWeb
Height = 23 Height = 23
ElementID = 'wcbprint' ElementID = 'wcbprint'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
...@@ -1193,6 +1304,8 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1193,6 +1304,8 @@ object FOrderEntryWeb: TFOrderEntryWeb
Height = 23 Height = 23
ElementID = 'wcbcolorcontract' ElementID = 'wcbcolorcontract'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
...@@ -1210,6 +1323,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1210,6 +1323,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 91 ChildOrder = 91
ElementID = 'btncopy' ElementID = 'btncopy'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCopyClick OnClick = btnCopyClick
end end
...@@ -1222,6 +1336,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1222,6 +1336,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 79 ChildOrder = 79
ElementID = 'btndelete' ElementID = 'btndelete'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnDeleteClick OnClick = btnDeleteClick
end end
...@@ -1234,6 +1349,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1234,6 +1349,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 80 ChildOrder = 80
ElementID = 'btnclose' ElementID = 'btnclose'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCloseClick OnClick = btnCloseClick
end end
...@@ -1242,24 +1358,14 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1242,24 +1358,14 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 194 Top = 194
Width = 121 Width = 121
Height = 22 Height = 22
TabStop = False
ChildOrder = 81 ChildOrder = 81
ElementID = 'edtordernum' ElementID = 'edtordernum'
Enabled = False Enabled = False
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
ShowFocus = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object btn_confirm_delete: TWebButton
Left = 1094
Top = 414
Width = 96
Height = 25
Caption = 'Delete'
ChildOrder = 82
ElementID = 'btn_confirm_delete'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btn_confirm_deleteClick
end
object btnEdit: TWebButton object btnEdit: TWebButton
Left = 1165 Left = 1165
Top = 560 Top = 560
...@@ -1269,6 +1375,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1269,6 +1375,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 83 ChildOrder = 83
ElementID = 'btnedit' ElementID = 'btnedit'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnEditClick OnClick = btnEditClick
end end
...@@ -1281,6 +1388,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1281,6 +1388,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 84 ChildOrder = 84
ElementID = 'btnadd' ElementID = 'btnadd'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnAddClick OnClick = btnAddClick
end end
...@@ -1293,6 +1401,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1293,6 +1401,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
ChildOrder = 85 ChildOrder = 85
ElementID = 'btnaddaddress' ElementID = 'btnaddaddress'
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = WebButton2Click OnClick = WebButton2Click
end end
...@@ -1301,17 +1410,10 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1301,17 +1410,10 @@ object FOrderEntryWeb: TFOrderEntryWeb
Left = 160 Left = 160
Top = 18 Top = 18
end end
object tmrScrollTop: TWebTimer
Interval = 100
OnTimer = tmrScrollTopTimer
Left = 240
Top = 8
end
object XDataWebDataSet1: TXDataWebDataSet object XDataWebDataSet1: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 90 Left = 408
Top = 20 Top = 4
object XDataWebDataSet1ORDER_ID: TIntegerField object XDataWebDataSet1ORDER_ID: TIntegerField
FieldName = 'ORDER_ID' FieldName = 'ORDER_ID'
end end
...@@ -1568,32 +1670,33 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1568,32 +1670,33 @@ object FOrderEntryWeb: TFOrderEntryWeb
end end
end end
object WebDataSource1: TWebDataSource object WebDataSource1: TWebDataSource
AutoEdit = False
DataSet = XDataWebDataSet1 DataSet = XDataWebDataSet1
Left = 22 Left = 406
Top = 10 Top = 38
end end
object wdsShipTo: TWebDataSource object wdsShipTo: TWebDataSource
AutoEdit = False
DataSet = xdwdsShipTo DataSet = xdwdsShipTo
Left = 212 Left = 320
Top = 436 Top = 38
end end
object xdwdsShipTo: TXDataWebDataSet object xdwdsShipTo: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit Left = 322
Left = 208 Top = 6
Top = 398
object xdwdsShipToADDRESS: TStringField object xdwdsShipToADDRESS: TStringField
FieldName = 'ADDRESS' FieldName = 'ADDRESS'
end end
end end
object wdsQBItem: TWebDataSource object wdsQBItem: TWebDataSource
AutoEdit = False
DataSet = xdwdsQBItem DataSet = xdwdsQBItem
Left = 240 Left = 244
Top = 518 Top = 34
end end
object xdwdsQBItem: TXDataWebDataSet object xdwdsQBItem: TXDataWebDataSet
AfterEdit = XDataWebDataSet1AfterEdit Left = 246
Left = 200 Top = 2
Top = 512
object xdwdsQBItemname: TStringField object xdwdsQBItemname: TStringField
FieldName = 'name' FieldName = 'name'
end end
...@@ -1601,7 +1704,7 @@ object FOrderEntryWeb: TFOrderEntryWeb ...@@ -1601,7 +1704,7 @@ object FOrderEntryWeb: TFOrderEntryWeb
object tmrReturn: TWebTimer object tmrReturn: TWebTimer
Enabled = False Enabled = False
OnTimer = tmrReturnTimer OnTimer = tmrReturnTimer
Left = 306 Left = 216
Top = 62 Top = 258
end end
end end
<nav class="navbar navbar-expand navbar-light bg-light sticky-top" style="z-index: 100;"> <nav class="navbar navbar-expand navbar-light bg-light border-light sticky-top" style="z-index: 100;">
<div class="container-fluid ps-0"> <div class="container-fluid d-flex align-items-center ps-0 pe-0">
<div id="view.login.message" class="alert alert-danger"
style="padding: 0.25rem 0.5rem; font-size: 0.875rem; line-height: 1.5; display: flex; align-items: center; margin: 0 0 0 60px; height: 32px; width: 400px;"> <!-- Left-aligned label -->
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button> <div class="me-auto ps-3">
<span id="view.login.message.label"></span> <label id="lbl_form_state" class="form-label mb-0 fw-bold text-uppercase text-nowrap text-danger" style="font-size: 16px;">Test</label>
</div>
<ul class="navbar-nav me-auto ps-2">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btncopy" class="btn btn-primary btn-sm">Copy</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-secondary btn-sm">Close</button>
</li>
</ul>
</div> </div>
<!-- Right-aligned buttons -->
<ul class="navbar-nav ms-auto pe-2 mb-0">
<li class="nav-item pe-2">
<button id="btnadd" class="btn btn-primary btn-sm">Add</button>
</li>
<li class="nav-item pe-2">
<button id="btnedit" class="btn btn-primary btn-sm">Edit</button>
</li>
<li class="nav-item pe-2">
<button id="btncopy" class="btn btn-primary btn-sm">Copy</button>
</li>
<li class="nav-item pe-2">
<button id="btndelete" class="btn btn-danger btn-sm">Delete</button>
</li>
<li class="nav-item pe-2">
<button id="btnpdf" class="btn btn-primary btn-sm">PDF</button>
</li>
<li class="nav-item pe-2">
<button id="btnconfirm" class="btn btn-success btn-sm">Save</button>
</li>
<li class="nav-item pe-2">
<button id="btncancel" class="btn btn-danger btn-sm">Cancel</button>
</li>
<li class="nav-item">
<button id="btnclose" class="btn btn-primary btn-sm">Close</button>
</li>
</ul>
</div>
</nav> </nav>
<div class="row mx-5"> <div class="row mx-5">
<h4 class="custom-h4 mt-3">Customer</h4> <h4 class="custom-h4 mt-3">Customer</h4>
...@@ -248,25 +251,43 @@ ...@@ -248,25 +251,43 @@
<input class="form-control input-sm" id="dtpdigitalcolordate" type="date"> <input class="form-control input-sm" id="dtpdigitalcolordate" type="date">
</div> </div>
</div> </div>
<h4 class="custom-h4 mt-3">Quantity and Colors</h4> <h4 class="custom-h4 mt-3">Quantity</h4>
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Press Name:</label> <label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Press Name:</label>
<input id="edtpressname" class="form-control input-sm" width='50%'/> <input id="edtpressname" class="form-control input-sm" width="50%" />
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Anilax Info:</label> <label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Anilax Info:</label>
<input id="edtanilaxinfo" class="form-control input-sm" width='50%'/> <input id="edtanilaxinfo" class="form-control input-sm" width="50%" />
</div> </div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" 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> </div>
<h4 class="custom-h4 mt-3">Colors</h4>
<hr class="custom-hr">
<div class="row align-items-center">
<!-- placeholders for the 4 dynamic input columns to center the Add Color button -->
<div class="col-sm"></div>
<div class="col-sm"></div>
<div class="col-sm"></div>
<div class="col-sm"></div>
<div class="col-auto d-flex justify-content-center">
<!-- Delphi-generated TWebButton stays here -->
<button id="btnaddcolor" class="btn btn-primary btn-sm me-3">
Add Color
</button>
</div>
</div>
<!-- Dynamically injected color rows go here -->
<div id="additionalFields" class="row mt-3"></div>
<h4 class="custom-h4 mt-3">Plate Marks</h4> <h4 class="custom-h4 mt-3">Plate Marks</h4>
<hr class="custom-hr"> <hr class="custom-hr">
<div class="row"> <div class="row">
<div class="col-auto"> <div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Microdots:</label> <label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Microdots:</label>
...@@ -404,53 +425,5 @@ ...@@ -404,53 +425,5 @@
<textarea id="edtcomments" class="form-control" style=" width: 500px; height: 150px;"></textarea> <textarea id="edtcomments" class="form-control" style=" width: 500px; height: 150px;"></textarea>
</div> </div>
</div> </div>
<div class="row">
<div class="col-auto">
<button id="btnconfirm" class="btn btn-primary btn-sm float-end my-2">Save</button>
</div>
<div class="col-auto">
<button id="btncancel" class="btn btn-primary btn-sm float-end my-2">Cancel</button>
</div>
<div class="col-auto">
<button id="btncopy" class="btn btn-primary btn-sm float-end my-2">Copy</button>
</div>
<div class="col-auto">
<button id="btnpdf" class="btn btn-primary btn-sm float-end my-2">PDF</button>
</div>
<div class="col-auto">
<button id="btndelete" class="btn btn-primary btn-sm float-end my-2">Delete</button>
</div>
<div class="col-auto">
<button id="btnclose" class="btn btn-primary btn-sm float-end my-2">Close</button>
</div>
<div class="col-auto">
<button id="btnedit" class="btn btn-primary btn-sm float-end my-2">Edit</button>
</div>
<div class="col-auto">
<button id="btnadd" class="btn btn-primary btn-sm float-end my-2">Add</button>
</div>
</div>
</div>
<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">Confirm</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="modal_body">
Are you sure you want to delete this order?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id=btn_confirm_cancel>Cancel</button>
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" id="btn_confirm_delete">Delete</button>
</div>
</div>
</div>
</div>
</div> </div>
<style>
.modal-backdrop {
opacity: 0 !important;
}
</style>
...@@ -7,19 +7,15 @@ uses ...@@ -7,19 +7,15 @@ uses
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage, WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls, ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB; Data.DB, XData.Web.JsonDataset, XData.Web.Dataset, WEBLib.DB, VCL.Forms;
type type
TFOrderEntryWeb = class(TWebForm) TFOrderEntryWeb = class(TWebForm)
WebLabel2: TWebLabel; WebLabel2: TWebLabel;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
edtCompanyName: TWebDBEdit; edtCompanyName: TWebDBEdit;
edtCompanyAccountName: TWebDBEdit; edtCompanyAccountName: TWebDBEdit;
edtInQuickBooks: TWebDBEdit; edtInQuickBooks: TWebDBEdit;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
tmrScrollTop: TWebTimer;
XDataWebDataSet1: TXDataWebDataSet; XDataWebDataSet1: TXDataWebDataSet;
XDataWebDataSet1ORDER_ID: TIntegerField; XDataWebDataSet1ORDER_ID: TIntegerField;
XDataWebDataSet1COMPANY_ID: TIntegerField; XDataWebDataSet1COMPANY_ID: TIntegerField;
...@@ -202,18 +198,14 @@ type ...@@ -202,18 +198,14 @@ type
btnDelete: TWebButton; btnDelete: TWebButton;
btnClose: TWebButton; btnClose: TWebButton;
edtOrderNum: TWebEdit; edtOrderNum: TWebEdit;
btn_confirm_delete: TWebButton;
tmrReturn: TWebTimer; tmrReturn: TWebTimer;
btnEdit: TWebButton; btnEdit: TWebButton;
btnAdd: TWebButton; btnAdd: TWebButton;
WebButton2: TWebButton; WebButton2: TWebButton;
lblFormState: TWebLabel;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure WebFormShow(Sender: TObject);
[async] procedure getOrder(Order_ID: string); [async] procedure getOrder(Order_ID: string);
[async] procedure getCustomer(customerID: string); [async] procedure getCustomer(customerID: string);
procedure tmrScrollTopTimer(Sender: TObject);
procedure WebButton1Click(Sender: TObject); procedure WebButton1Click(Sender: TObject);
procedure addColorRow(num, Color, LPI, Size: string); procedure addColorRow(num, Color, LPI, Size: string);
procedure btnSaveClick(Sender: TObject); procedure btnSaveClick(Sender: TObject);
...@@ -226,20 +218,17 @@ type ...@@ -226,20 +218,17 @@ type
procedure btnCloseClick(Sender: TObject); procedure btnCloseClick(Sender: TObject);
procedure btnDeleteClick(Sender: TObject); procedure btnDeleteClick(Sender: TObject);
[async] procedure DelOrder; [async] procedure DelOrder;
procedure btnCloseNotificationClick(Sender: TObject);
procedure tmrReturnTimer(Sender: TObject); procedure tmrReturnTimer(Sender: TObject);
procedure btn_confirm_deleteClick(Sender: TObject);
function VerifyOrder(): boolean; function VerifyOrder(): boolean;
procedure btnAddClick(Sender: TObject); procedure btnAddClick(Sender: TObject);
procedure btnEditClick(Sender: TObject); procedure btnEditClick(Sender: TObject);
procedure EditMode(); procedure EditMode();
procedure XDataWebDataSet1AfterEdit(DataSet: TDataSet);
procedure dtpOrderDateChange(Sender: TObject);
procedure ViewMode(); procedure ViewMode();
procedure WebButton2Click(Sender: TObject); procedure WebButton2Click(Sender: TObject);
procedure ShowAddAddressForm(); procedure ShowAddAddressForm();
[async] procedure SendAddressToServer(AddressJSON: TJSONObject); [async] procedure SendAddressToServer(AddressJSON: TJSONObject);
private private
FModalAction: string;
FAgencyCode: string; FAgencyCode: string;
FCurrentReportType: string; FCurrentReportType: string;
FSelectProc: TSelectProc; FSelectProc: TSelectProc;
...@@ -247,9 +236,11 @@ type ...@@ -247,9 +236,11 @@ type
customerID: string; customerID: string;
mode: string; mode: string;
notification: string; notification: string;
procedure RemoveColorRow(Sender: TObject);
[async] procedure InitializeForm;
//FJSONProc1: TJSONProc1; //FJSONProc1: TJSONProc1;
public public
class function CreateForm(AElementID, orderInfo, customerInfo, mode, info: string): TWebForm; class function CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
end; end;
var var
...@@ -262,6 +253,46 @@ implementation ...@@ -262,6 +253,46 @@ implementation
uses uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils; View.Home, View.Main, View.AddOrder, View.AddAddress, Utils;
class function TFOrderEntryWeb.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
begin
Application.CreateForm(TFOrderEntryWeb, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntryWeb(AForm) do
begin
customerID := customerInfo;
orderID := orderInfo;
mode := modeParam;
notification := info;
console.log('Mode in createform: ' + modeParam);
InitializeForm;
end;
end
);
end;
[async] procedure TFOrderEntryWeb.InitializeForm;
begin
if mode = 'ADD' then
begin
await(getCustomer(customerID));
EditMode;
end
else
begin
await(getOrder(orderID));
ViewMode;
end;
edtOrderNum.Text := orderID;
if notification <> '' then
ShowToast(notification);
end;
procedure TFOrderEntryWeb.WebButton2Click(Sender: TObject); procedure TFOrderEntryWeb.WebButton2Click(Sender: TObject);
begin begin
ShowAddAddressForm(); ShowAddAddressForm();
...@@ -276,7 +307,7 @@ begin ...@@ -276,7 +307,7 @@ begin
[AddressJSON.ToString])); [AddressJSON.ToString]));
notification := TJSObject(Response.Result); notification := TJSObject(Response.Result);
ShowNotification(string(notification['status'])); ShowToast(string(notification['status']));
xdwdsShipTo.Close; xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(notification['ADDRESS']); xdwdsShipTo.SetJSONData(notification['ADDRESS']);
xdwdsShipTo.Open; xdwdsShipTo.Open;
...@@ -294,6 +325,7 @@ begin ...@@ -294,6 +325,7 @@ begin
newform.Caption := 'Input Shipping Information'; newform.Caption := 'Input Shipping Information';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
window.location.hash := 'subform'; window.location.hash := 'subform';
...@@ -412,24 +444,27 @@ begin ...@@ -412,24 +444,27 @@ begin
dtpDigitalColorDate.Date := 0; dtpDigitalColorDate.Date := 0;
edtOrderNum.Text := ''; edtOrderNum.Text := '';
EditMode(); EditMode();
ShowNotification('Success:Order Successfully Copied'); ShowToast('Success: Order Successfully Copied');
window.scrollTo(0, 0); window.scrollTo(0, 0);
end; end;
procedure TFOrderEntryWeb.btnDeleteClick(Sender: TObject); procedure TFOrderEntryWeb.btnDeleteClick(Sender: TObject);
begin begin
asm ShowConfirmationModal(
var modal = document.getElementById('confirmation_modal'); 'Are you sure you want to delete this order?',
// ensure the modal is directly under <body> 'Delete',
if (modal && modal.parentNode !== document.body) { 'Cancel',
document.body.appendChild(modal); procedure(confirmed: Boolean)
} begin
if confirmed then
var bsModal = new bootstrap.Modal(modal, { begin
keyboard: false Utils.ShowSpinner('spinner');
}); DelOrder();
bsModal.show(); tmrReturn.Enabled := true;
end; end;
end
);
end; end;
procedure TFOrderEntryWeb.btnEditClick(Sender: TObject); procedure TFOrderEntryWeb.btnEditClick(Sender: TObject);
...@@ -437,30 +472,12 @@ begin ...@@ -437,30 +472,12 @@ begin
EditMode(); EditMode();
end; end;
procedure TFOrderEntryWeb.EditMode;
begin
FViewMain.change := true;
btnCopy.Enabled := false;
btnPDF.Enabled := false;
btnDelete.Enabled := false;
btnClose.Enabled := false;
btnSave.Enabled := true;
btnCancel.Enabled := True;
btnEdit.Enabled := false;
btnAdd.Enabled := false;
end;
[async] procedure TFOrderEntryWeb.DelOrder(); [async] procedure TFOrderEntryWeb.DelOrder();
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
begin begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelOrder', Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelOrder', [OrderID, 'web', JS.toString(AuthService.TokenPayload.Properties['user_id'])]));
[OrderID, 'web', JS.toString(AuthService.TokenPayload.Properties['user_id'])]));
end;
procedure TFOrderEntryWeb.dtpOrderDateChange(Sender: TObject);
begin
EditMode();
end; end;
procedure TFOrderEntryWeb.SendOrderToServer(); procedure TFOrderEntryWeb.SendOrderToServer();
...@@ -550,7 +567,7 @@ begin ...@@ -550,7 +567,7 @@ begin
else else
info := 'Success:Order Successfully Added'; info := 'Success:Order Successfully Added';
AddWebOrder(orderJSON); AddWebOrder(orderJSON);
ShowNotification(info); ShowToast(info);
end; end;
procedure TFOrderEntryWeb.btnPDFClick(Sender: TObject); procedure TFOrderEntryWeb.btnPDFClick(Sender: TObject);
...@@ -558,38 +575,6 @@ begin ...@@ -558,38 +575,6 @@ begin
GenerateReportPDF; GenerateReportPDF;
end; end;
procedure TFOrderEntryWeb.btn_confirm_deleteClick(Sender: TObject);
begin
if document.getElementById('btn_confirm_delete').innerText = 'Yes' then
begin
FViewMain.change := false;
if OrderID <> '' then
begin
FViewMain.ViewOrderEntryWeb(OrderID, '', 'EDIT', 'Failure:Changes Discarded');
end
else
FViewMain.ViewOrders('');
end
else
begin
Utils.ShowSpinner('spinner');
asm
var modal = document.getElementById('confirmation_modal');
// ensure the modal is directly under <body>
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
var bsModal = new bootstrap.Modal(modal, {
keyboard: false
});
bsModal.hide();
end;
delOrder();
tmrReturn.Enabled := true;
end;
end;
procedure TFOrderEntryWeb.GenerateReportPDF; procedure TFOrderEntryWeb.GenerateReportPDF;
// sends the search to the server which then sends back a pdf of the results // sends the search to the server which then sends back a pdf of the results
var var
...@@ -597,108 +582,116 @@ var ...@@ -597,108 +582,116 @@ var
searchOptions, pdfURL: string; searchOptions, pdfURL: string;
jsObject: TJSObject; jsObject: TJSObject;
begin begin
try
// Call the server method to generate the PDF // Call the server method to generate the PDF
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderWebPDF', [orderID])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderWebPDF', [orderID]));
jsObject := JS.TJSObject(xdcResponse.Result); jsObject := JS.TJSObject(xdcResponse.Result);
pdfURL := JS.toString(jsObject.Properties['value']); pdfURL := JS.toString(jsObject.Properties['value']);
// Open the PDF in a new browser tab without needing a different form // Open the PDF in a new browser tab without needing a different form
// This method is much faster too, even for large datasets // This method is much faster too, even for large datasets
window.open(pdfURL, '_blank'); window.open(pdfURL, '_blank');
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not generate web order PDF: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
procedure TFOrderEntryWeb.AddWebOrder(orderJSON: TJSONObject); procedure TFOrderEntryWeb.AddWebOrder(orderJSON: TJSONObject);
// sends the order JSON object to the server // sends the order JSON object to the server
var var
Response: TXDataClientResponse; Response: TXDataClientResponse;
jsObj: TJSObject; jsObj: TJSObject;
begin begin
Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddWebOrder', try
[orderJSON.ToString])); Response := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddWebOrder', [orderJSON.ToString]));
jsObj := JS.TJSObject(Response.Result); jsObj := JS.TJSObject(Response.Result);
if mode = 'ADD' then if mode = 'ADD' then
OrderID := String(jsObj.Properties['OrderID']); OrderID := String(jsObj.Properties['OrderID']);
console.log(OrderID); edtOrderNum.Text := OrderID;
mode := 'EDIT'; mode := 'EDIT';
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not save web order: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
class function TFOrderEntryWeb.CreateForm(AElementID, orderInfo, customerInfo, mode, info: string): TWebForm; procedure TFOrderEntryWeb.addColorRow(num: string; Color: string; LPI: string; Size: string);
var var
localMode: string; container, newRow, col, labelEl, inputEl, removeCol: TJSHTMLElement;
removeBtn: TWebButton;
values: array[0..3] of string;
labels: array[0..3] of string;
i: Integer;
begin begin
localMode := mode; container := TJSHTMLElement(document.getElementById('additionalFields'));
Application.CreateForm(TFOrderEntryWeb, AElementID, Result,
procedure(AForm: TObject)
begin
with TFOrderEntryWeb(AForm) do
begin
HideNotification;
TFOrderEntryWeb(AForm).customerID := customerInfo;
TFOrderEntryWeb(AForm).orderID := orderInfo;
TFOrderEntryWeb(AForm).mode := localMode;
TFOrderEntryWeb(AForm).notification := info;
end;
end
);
// Create the new row container
newRow := TJSHTMLElement(document.createElement('div'));
newRow.className := 'row mb-2';
labels[0] := '#'; values[0] := num;
labels[1] := 'Color'; values[1] := color;
labels[2] := 'LPI'; values[2] := LPI;
labels[3] := 'Size'; values[3] := size;
for i := 0 to 3 do
begin
col := TJSHTMLElement(document.createElement('div'));
col.className := 'col-sm';
labelEl := TJSHTMLElement(document.createElement('label'));
labelEl.className := 'pe-2';
labelEl.style.setProperty('font-weight', '700');
labelEl.style.setProperty('font-size', '15px');
labelEl.textContent := labels[i] + ':';
inputEl := TJSHTMLElement(document.createElement('input'));
inputEl.className := 'form-control input-sm';
inputEl.setAttribute('style', 'width: 100%');
inputEl.setAttribute('value', values[i]);
inputEl.setAttribute('id', 'input-' + IntToStr(container.childElementCount) + '-' + IntToStr(i));
col.appendChild(labelEl);
col.appendChild(inputEl);
newRow.appendChild(col);
end;
// Add remove button
removeCol := TJSHTMLElement(document.createElement('div'));
removeCol.className := 'col-auto d-flex align-items-end pb-1';
removeBtn := TWebButton.Create(Self);
removeBtn.Caption := 'Remove';
removeBtn.ElementClassName := 'btn btn-danger btn-sm mt-1';
removeBtn.ParentElement := removeCol;
removeBtn.ElementHandle.style.setProperty('height', '30px');
removeBtn.OnClick := RemoveColorRow;
newRow.appendChild(removeCol);
container.appendChild(newRow);
end; end;
procedure TFOrderEntryWeb.addColorRow(num: string; Color: string; LPI: string; Size: string); procedure TFOrderEntryWeb.RemoveColorRow(Sender: TObject);
// Java script code to add a row of colors when a button is clicked var
// all variables are information to be placed in the boxes when loading an order. btn: TWebButton;
// TODO: convert to Delphi rowElement: TJSHTMLElement;
begin begin
asm EditMode();
const container = document.getElementById('additionalFields'); btn := TWebButton(Sender);
if Assigned(btn.ElementHandle) and Assigned(btn.ElementHandle.parentElement) then
// Create a new row for the new fields begin
const newRow = document.createElement('div'); // Assuming button is inside a <div> inside the row
newRow.className = 'row mb-2'; rowElement := TJSHTMLElement(btn.ElementHandle.parentElement.parentElement);
if Assigned(rowElement) then
const labels = ['#', 'Color', 'LPI', 'Size']; rowElement.remove;
const values = [num, Color, LPI, Size]; end;
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);
container.appendChild(newRow);
end;
end; end;
procedure TFOrderEntryWeb.WebButton1Click(Sender: TObject); procedure TFOrderEntryWeb.WebButton1Click(Sender: TObject);
begin begin
EditMode();
addColorRow('','','',''); addColorRow('','','','');
end; end;
...@@ -712,6 +705,7 @@ begin ...@@ -712,6 +705,7 @@ begin
newform.Caption := 'Select Customer and Order Type'; newform.Caption := 'Select Customer and Order Type';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
window.location.hash := 'subform'; window.location.hash := 'subform';
...@@ -741,21 +735,22 @@ end; ...@@ -741,21 +735,22 @@ end;
procedure TFOrderEntryWeb.btnCancelClick(Sender: TObject); procedure TFOrderEntryWeb.btnCancelClick(Sender: TObject);
begin begin
document.getElementById('modal_body').innerHTML := 'Are you sure you want to cancel all changes?'; ShowConfirmationModal(
document.getElementById('btn_confirm_cancel').innerText := 'No'; 'Are you sure you want to cancel all changes?',
document.getElementById('btn_confirm_delete').innerText := 'Yes'; 'Yes',
asm 'No',
var modal = document.getElementById('confirmation_modal'); procedure(confirmed: Boolean)
// ensure the modal is directly under <body> begin
if (modal && modal.parentNode !== document.body) { if confirmed then
document.body.appendChild(modal); begin
} FViewMain.change := false;
if OrderID <> '' then
var bsModal = new bootstrap.Modal(modal, { FViewMain.ViewOrderEntryWeb(OrderID, '', 'EDIT', 'Failure: Changes Discarded')
keyboard: false else
}); FViewMain.ViewOrders('');
bsModal.show(); end;
end; end
);
end; end;
procedure TFOrderEntryWeb.btnCloseClick(Sender: TObject); procedure TFOrderEntryWeb.btnCloseClick(Sender: TObject);
...@@ -763,10 +758,6 @@ begin ...@@ -763,10 +758,6 @@ begin
FViewMain.ViewOrders(''); FViewMain.ViewOrders('');
end; end;
procedure TFOrderEntryWeb.btnCloseNotificationClick(Sender: TObject);
begin
hideNotification();
end;
procedure TFOrderEntryWeb.WebFormCreate(Sender: TObject); procedure TFOrderEntryWeb.WebFormCreate(Sender: TObject);
begin begin
...@@ -795,107 +786,108 @@ var ...@@ -795,107 +786,108 @@ var
colorListJSON: TJSONArray; colorListJSON: TJSONArray;
items: TJSObject; items: TJSObject;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetWebOrder', Utils.ShowSpinner('spinner');
[Order_ID])); try
order := TJSObject(xdcResponse.Result); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetWebOrder',
data := TJSArray(order['data']); [Order_ID]));
XDataWebDataSet1.Close; order := TJSObject(xdcResponse.Result);
XDataWebDataSet1.SetJsonData(order); data := TJSArray(order['data']);
XDataWebDataSet1.Open; XDataWebDataSet1.Close;
if XDataWebDataSet1quantity_and_colors_qty_colors.Value <> '' then XDataWebDataSet1.SetJsonData(order);
begin XDataWebDataSet1.Open;
colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1quantity_and_colors_qty_colors.Value));
colorList := TJSArray(colorObject['items']); if XDataWebDataSet1quantity_and_colors_qty_colors.Value <> '' then
for I := 0 to colorList.length -1 do
begin begin
color := TJSObject(colorList[i]); colorObject := TJSObject(TJSJSON.parse(XDataWebDataSet1quantity_and_colors_qty_colors.Value));
addColorRow(String(color['#']), string(color['Color']), string(color['LPI']), string(color['Size'])); 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; end;
end;
// Dates need to be manually set
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 (XDataWebDataSet1proofing_pdf_date_1.AsString = '') then
dtpPDFDate1.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_1.Value)
else
dtpPDFDate1.Date := 0;
if not (XDataWebDataSet1proofing_pdf_date_2.AsString = '') then // Dates need to be manually set
dtpPDFDate2.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_2.Value) if not (XDataWebDataSet1staff_fields_order_date.AsString = '') then
else dtpOrderDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_order_date.Value)
dtpPDFDate2.Date := 0; else
dtpOrderDate.Date := 0;
if not (XDataWebDataSet1proofing_pdf_date_3.AsString = '') then if not (XDataWebDataSet1staff_fields_proof_date.AsString = '') then
dtpPDFDate3.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_3.Value) dtpProofDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_proof_date.AsString)
else else
dtpPDFDate3.Date := 0; dtpProofDate.Date := 0;
if not (XDataWebDataSet1staff_fields_ship_date.AsString = '') then
if not (XDataWebDataSet1proofing_ink_jet_date_1.AsString = '') then dtpShipDate.Date := StrToDateTime(XDataWebDataSet1staff_fields_ship_date.AsString)
dtpInkJetDate1.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_1.Value) else
else dtpShipDate.Date := 0;
dtpInkJetDate1.Date := 0; if not (XDataWebDataSet1staff_fields_art_due.AsString = '') then
dtpArtDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_art_due.AsString)
if not (XDataWebDataSet1proofing_ink_jet_date_2.AsString = '') then else
dtpInkJetDate2.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_2.Value) dtpArtDue.Date := 0;
else if not (XDataWebDataSet1staff_fields_plate_due.AsString = '') then
dtpInkJetDate2.Date := 0; dtpPlateDue.Date := StrToDateTime(XDataWebDataSet1staff_fields_plate_due.AsString)
else
if not (XDataWebDataSet1proofing_ink_jet_date_3.AsString = '') then dtpPlateDue.Date := 0;
dtpInkJetDate3.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_3.Value)
else
dtpInkJetDate3.Date := 0;
if not (XDataWebDataSet1proofing_color_contrac_date_1.AsString = '') then if not (XDataWebDataSet1proofing_pdf_date_1.AsString = '') then
dtpColorContractDate1.Date := StrToDateTime(XDataWebDataSet1proofing_color_contrac_date_1.Value) dtpPDFDate1.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_1.Value)
else else
dtpColorContractDate1.Date := 0; dtpPDFDate1.Date := 0;
if not (XDataWebDataSet1proofing_pdf_date_2.AsString = '') then
dtpPDFDate2.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_2.Value)
else
dtpPDFDate2.Date := 0;
if not (XDataWebDataSet1proofing_pdf_date_3.AsString = '') then
dtpPDFDate3.Date := StrToDateTime(XDataWebDataSet1proofing_pdf_date_3.Value)
else
dtpPDFDate3.Date := 0;
if not (XDataWebDataSet1proofing_color_contrac_date_2.AsString = '') then if not (XDataWebDataSet1proofing_ink_jet_date_1.AsString = '') then
dtpColorContractDate2.Date := StrToDateTime(XDataWebDataSet1proofing_color_contrac_date_2.Value) dtpInkJetDate1.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_1.Value)
else else
dtpColorContractDate2.Date := 0; dtpInkJetDate1.Date := 0;
if not (XDataWebDataSet1proofing_ink_jet_date_2.AsString = '') then
dtpInkJetDate2.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_2.Value)
else
dtpInkJetDate2.Date := 0;
if not (XDataWebDataSet1proofing_ink_jet_date_3.AsString = '') then
dtpInkJetDate3.Date := StrToDateTime(XDataWebDataSet1proofing_ink_jet_date_3.Value)
else
dtpInkJetDate3.Date := 0;
if not (XDataWebDataSet1proofing_digital_color_date_1.AsString = '') then if not (XDataWebDataSet1proofing_color_contrac_date_1.AsString = '') then
dtpDigitalColorDate.Date := StrToDateTime(XDataWebDataSet1proofing_digital_color_date_1.Value) dtpColorContractDate1.Date := StrToDateTime(XDataWebDataSet1proofing_color_contrac_date_1.Value)
else else
dtpDigitalColorDate.Date := 0; dtpColorContractDate1.Date := 0;
if not (XDataWebDataSet1proofing_color_contrac_date_2.AsString = '') then
dtpColorContractDate2.Date := StrToDateTime(XDataWebDataSet1proofing_color_contrac_date_2.Value)
else
dtpColorContractDate2.Date := 0;
if not (XDataWebDataSet1proofing_digital_color_date_1.AsString = '') then
dtpDigitalColorDate.Date := StrToDateTime(XDataWebDataSet1proofing_digital_color_date_1.Value)
else
dtpDigitalColorDate.Date := 0;
if mode = 'EDIT' then
begin
CustomerID := XDataWebDataSet1COMPANY_ID.AsString;
xdwdsShipTo.Close;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']);
xdwdsShipTo.Open;
end;
if mode = 'EDIT' then xdwdsQBItem.Close;
begin items := TJSObject(order['ITEMS']);
CustomerID := XDataWebDataSet1COMPANY_ID.AsString; xdwdsQBItem.SetJsonData(items['data']);
xdwdsShipTo.Close; xdwdsQBITEM.Open;
xdwdsShipTo.SetJSONData(order['ADDRESS_LIST']); except
xdwdsShipTo.Open; on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve order: ' + E.ErrorResult.ErrorMessage);
end; end;
Utils.HideSpinner('spinner');
end;
xdwdsQBItem.Close;
items := TJSObject(order['ITEMS']);
xdwdsQBItem.SetJsonData(items['data']);
xdwdsQBITEM.Open;
end;
procedure TFOrderEntryWeb.getCustomer(customerID: string); procedure TFOrderEntryWeb.getCustomer(customerID: string);
// gets a customer from the database then loads the appropiate fields // gets a customer from the database then loads the appropiate fields
...@@ -940,68 +932,6 @@ begin ...@@ -940,68 +932,6 @@ begin
end; end;
procedure TFOrderEntryWeb.WebFormShow(Sender: TObject);
begin
if mode <> 'ADD' then
begin
getOrder(orderID);
ViewMode();
end
else
begin
getCustomer(customerID);
EditMode();
end;
edtOrderNum.Text := OrderID;
if notification = '' then
begin
HideNotification;
end
else
begin
ShowNotification(notification);
end;
end;
procedure TFOrderEntryWeb.XDataWebDataSet1AfterEdit(DataSet: TDataSet);
begin
EditMode();
end;
procedure TFOrderEntryWeb.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFOrderEntryWeb.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end;
procedure TFOrderEntryWeb.tmrReturnTimer(Sender: TObject); procedure TFOrderEntryWeb.tmrReturnTimer(Sender: TObject);
begin begin
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
...@@ -1009,10 +939,25 @@ begin ...@@ -1009,10 +939,25 @@ begin
FViewMain.ViewOrders('Success: Order Successfully Deleted'); FViewMain.ViewOrders('Success: Order Successfully Deleted');
end; end;
procedure TFOrderEntryWeb.tmrScrollTopTimer(Sender: TObject); procedure TFOrderEntryWeb.EditMode;
begin begin
tmrScrollTop.Enabled := False; XDataWebDataSet1.Edit;
window.scrollTo(0, 0); FViewMain.change := true;
btnCopy.Enabled := false;
btnPDF.Enabled := false;
btnDelete.Enabled := false;
btnClose.Enabled := false;
btnSave.Enabled := true;
btnCancel.Enabled := True;
btnEdit.Enabled := false;
btnAdd.Enabled := false;
cbPdf.Enabled := True;
cbInkJet.Enabled := True;
lblFormState.Caption := 'Edit Mode';
lblFormState.ElementHandle.classList.remove('text-danger');
lblFormState.ElementHandle.classList.add('text-success');
end; end;
procedure TFOrderEntryWeb.ViewMode; procedure TFOrderEntryWeb.ViewMode;
...@@ -1026,6 +971,13 @@ begin ...@@ -1026,6 +971,13 @@ begin
btnEdit.Enabled := true; btnEdit.Enabled := true;
btnAdd.Enabled := true; btnAdd.Enabled := true;
FViewMain.change := false; FViewMain.change := false;
cbPdf.Enabled := False;
cbInkJet.Enabled := False;
lblFormState.Caption := 'View Mode';
lblFormState.ElementHandle.classList.remove('text-success');
lblFormState.ElementHandle.classList.add('text-danger');
end; end;
......
...@@ -237,9 +237,7 @@ object FViewOrders: TFViewOrders ...@@ -237,9 +237,7 @@ object FViewOrders: TFViewOrders
ItemIndex = -1 ItemIndex = -1
LookupValues = < LookupValues = <
item item
Value = Value = 'o.ORDER_ID DESC'
'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_dat' +
'e, cdo.staff_fields_order_date) DESC'
DisplayText = 'ID' DisplayText = 'ID'
end end
item item
...@@ -251,7 +249,9 @@ object FViewOrders: TFViewOrders ...@@ -251,7 +249,9 @@ object FViewOrders: TFViewOrders
DisplayText = 'Job Name' DisplayText = 'Job Name'
end end
item item
Value = 'o.ORDER_DATE DESC' Value =
'COALESCE(cpo.staff_fields_order_date, wpo.staff_fields_order_dat' +
'e, cdo.staff_fields_order_date) DESC'
DisplayText = 'Order Date' DisplayText = 'Order Date'
end end
item item
...@@ -309,36 +309,6 @@ object FViewOrders: TFViewOrders ...@@ -309,36 +309,6 @@ object FViewOrders: TFViewOrders
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object pnlMessage: TWebPanel
Left = 12
Top = 16
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder = 8
object lblMessage: TWebLabel
Left = 16
Top = 11
Width = 42
Height = 13
Caption = 'Message'
ElementID = 'view.login.message.label'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 28 Left = 28
......
<div class="container h-100 d-flex flex-column mt-0 py-0" style="max-width: 100%;"> <div class="container h-100 d-flex flex-column mt-0 py-0" style="max-width: 100%;">
<!-- Alert Section -->
<div class="row">
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div>
</div>
<!-- Actions Row --> <!-- Actions Row -->
<div class="row mt-2 justify-content-center"> <div class="row mt-2 justify-content-center">
<div class="col-auto d-flex align-items-center"> <div class="col-auto d-flex align-items-center">
......
...@@ -13,8 +13,8 @@ uses ...@@ -13,8 +13,8 @@ uses
WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, WEBLib.Menus, WEBLib.ExtCtrls, WEBLib.StdCtrls,
WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage, WEBLib.JSON, Auth.Service, XData.Web.Client, WebLib.Storage,
ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls, ConnectionModule, App.Types, Vcl.StdCtrls, Vcl.Controls, WEBLib.DBCtrls,
XData.Web.JsonDataset, WEBLib.DB, Data.DB, XData.Web.Dataset, XData.Web.JsonDataset, WEBLib.DB, Data.DB, XData.Web.Dataset, XData.Web.DatasetCommon,
WEBLib.Grids; WEBLib.Grids, VCL.Forms;
type type
TFViewOrders = class(TWebForm) TFViewOrders = class(TWebForm)
...@@ -56,15 +56,11 @@ type ...@@ -56,15 +56,11 @@ type
wcbPageSize: TWebComboBox; wcbPageSize: TWebComboBox;
wlcbOrderBy: TWebLookupComboBox; wlcbOrderBy: TWebLookupComboBox;
edtSearch: TWebEdit; edtSearch: TWebEdit;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
xdwdsOrdersDBID: TStringField; xdwdsOrdersDBID: TStringField;
tmrReturn: TWebTimer; tmrReturn: TWebTimer;
procedure WebFormCreate(Sender: TObject); procedure WebFormCreate(Sender: TObject);
procedure btnAddOrderClick(Sender: TObject); procedure btnAddOrderClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject); procedure btnSearchClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
procedure WebFormShow(Sender: TObject); procedure WebFormShow(Sender: TObject);
procedure btnPDFClick(Sender: TObject); procedure btnPDFClick(Sender: TObject);
procedure wcbPageSizeChange(Sender: TObject); procedure wcbPageSizeChange(Sender: TObject);
...@@ -73,20 +69,20 @@ type ...@@ -73,20 +69,20 @@ type
procedure wdbtcOrdersClickCell(Sender: TObject; ACol, ARow: Integer); procedure wdbtcOrdersClickCell(Sender: TObject; ACol, ARow: Integer);
procedure WebButton1Click(Sender: TObject); procedure WebButton1Click(Sender: TObject);
procedure tmrReturnTimer(Sender: TObject); procedure tmrReturnTimer(Sender: TObject);
[async] procedure GenerateReportPDFAsync(APdfTab: TJSWindow);
private private
FChildForm: TWebForm; FChildForm: TWebForm;
FPendingPdfTab: TJSWindow;
procedure ClearTable(); procedure ClearTable();
procedure GeneratePagination(TotalPages: Integer); procedure GeneratePagination(TotalPages: Integer);
function GenerateSearchOptions(): string; function GenerateSearchOptions(): string;
procedure orderEntry(orderInfo, customerInfo, mode, orderType: string); procedure OrderEntry(orderInfo, customerInfo, mode, orderType: string);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure ShowAddOrderForm(); procedure ShowAddOrderForm();
procedure ShowSearchForm(); procedure ShowSearchForm();
procedure ShowSetStatusForm(); procedure ShowSetStatusForm();
[async] procedure GetOrders(searchOptions: string); [async] procedure GetOrders(searchOptions: string);
[async] procedure GenerateReportPDF;
[async] procedure SetStatus(statusInfo: string); [async] procedure SetStatus(statusInfo: string);
procedure HandlePDFConfirmation;
var var
PageNumber: integer; PageNumber: integer;
PageSize: integer; PageSize: integer;
...@@ -143,32 +139,107 @@ begin ...@@ -143,32 +139,107 @@ begin
); );
end; end;
procedure TFViewOrders.btnPDFClick(Sender: TObject); procedure TFViewOrders.btnPDFClick(Sender: TObject);
begin begin
if xdwdsOrders.RecordCount >= 100 then
begin
FPendingPdfTab := nil;
ShowConfirmationModal(
'You are about to generate a PDF for over 100 orders. This may take some time. Continue?',
'Yes',
'Cancel',
procedure(confirmed: Boolean)
begin
if confirmed then
begin
HandlePDFConfirmation;
end;
end
);
end
else
begin
FPendingPdfTab := window.open('', '_blank');
if Assigned(FPendingPdfTab) then
FPendingPdfTab.document.write(
'<!DOCTYPE html>' +
'<html lang="en">' +
'<head>' +
'<meta charset="UTF-8">' +
'<meta name="viewport" content="width=device-width, initial-scale=1.0">' +
'<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">' +
'</head>' +
'<body class="d-flex flex-column justify-content-center align-items-center vh-100 bg-light">' +
'<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>' +
'<div class="mt-3 fs-5 text-muted">Generating PDF, please wait</div>' +
'</body>' +
'</html>'
);
Utils.ShowSpinner('spinner');
GenerateReportPDFAsync(FPendingPdfTab);
end;
end;
procedure TFViewOrders.HandlePDFConfirmation;
begin
// Open tab only now
FPendingPdfTab := window.open('', '_blank');
if Assigned(FPendingPdfTab) then
FPendingPdfTab.document.write(
'<!DOCTYPE html>' +
'<html lang="en">' +
'<head>' +
'<meta charset="UTF-8">' +
'<meta name="viewport" content="width=device-width, initial-scale=1.0">' +
'<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">' +
'</head>' +
'<body class="d-flex flex-column justify-content-center align-items-center vh-100 bg-light">' +
'<div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;"></div>' +
'<div class="mt-3 fs-5 text-muted">Generating PDF, please wait</div>' +
'</body>' +
'</html>'
);
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
GenerateReportPDF; GenerateReportPDFAsync(FPendingPdfTab);
FPendingPdfTab := nil;
end; end;
[async] procedure TFViewOrders.GenerateReportPDF;
// sends the search to the server which then sends back a pdf of the results [async] procedure TFViewOrders.GenerateReportPDFAsync(APdfTab: TJSWindow);
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
searchOptions, pdfURL: string; searchOptions, pdfURL: string;
jsObject: TJSObject; jsObject: TJSObject;
begin begin
searchOptions := edtSearch.Text; try
searchOptions := edtSearch.Text + '&forPDF=true';
// Call the server method to generate the PDF
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderListPDF', [searchOptions])); xdcResponse := await(
jsObject := JS.TJSObject(xdcResponse.Result); XDataWebClient1.RawInvokeAsync('ILookupService.GenerateOrderListPDF',
pdfURL := JS.toString(jsObject.Properties['value']); [searchOptions]));
jsObject := TJSObject(xdcResponse.Result);
// Open the PDF in a new browser tab without needing a different form pdfURL := String(jsObject.Properties['value']);
// This method is much faster too, even for large datasets
window.open(pdfURL, '_blank'); if Assigned(APdfTab) then
begin APdfTab.location.href := pdfURL;
Utils.HideSpinner('Spinner'); except
on E: EXDataClientRequestException do
begin
Utils.ShowErrorModal('Could not generate report PDF: ' +
E.ErrorResult.ErrorMessage);
if Assigned(APdfTab) then
APdfTab.close; // close the blank tab on failure
end;
end; end;
Utils.HideSpinner('spinner');
end; end;
...@@ -183,7 +254,7 @@ begin ...@@ -183,7 +254,7 @@ begin
ShowSetStatusForm; ShowSetStatusForm;
end end
else else
ShowNotification('Failure:Please select an order'); ShowToast('Failure: Please select an order');
end; end;
procedure TFViewOrders.WebFormCreate(Sender: TObject); procedure TFViewOrders.WebFormCreate(Sender: TObject);
...@@ -266,14 +337,13 @@ end; ...@@ -266,14 +337,13 @@ end;
procedure TFViewOrders.WebFormShow(Sender: TObject); procedure TFViewOrders.WebFormShow(Sender: TObject);
begin begin
if info <> '' then if info <> '' then
ShowNotification(info) ShowToast(info)
else
HideNotification();
end; end;
procedure TFViewOrders.wlcbOrderByChange(Sender: TObject); procedure TFViewOrders.wlcbOrderByChange(Sender: TObject);
begin begin
//console.log(wlcbOrderBy.Value);
OrderBy := wlcbOrderBy.Value; OrderBy := wlcbOrderBy.Value;
getOrders(generateSearchOptions()); getOrders(generateSearchOptions());
end; end;
...@@ -288,6 +358,7 @@ begin ...@@ -288,6 +358,7 @@ begin
newform.Caption := 'Select Customer and Order Type'; newform.Caption := 'Select Customer and Order Type';
newForm.Popup := True; newForm.Popup := True;
newForm.position:= poScreenCenter;
newForm.Border := fbDialog; newForm.Border := fbDialog;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
...@@ -320,6 +391,7 @@ begin ...@@ -320,6 +391,7 @@ begin
newform.Caption := 'Input Search Options'; newform.Caption := 'Input Search Options';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.position:= poScreenCenter;
newForm.searchOptions := FViewMain.search; newForm.searchOptions := FViewMain.search;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
...@@ -370,6 +442,7 @@ begin ...@@ -370,6 +442,7 @@ begin
newform.Caption := 'Input Search Options'; newform.Caption := 'Input Search Options';
newForm.Popup := True; newForm.Popup := True;
newForm.Border := fbDialog; newForm.Border := fbDialog;
newForm.Position := poScreenCenter;
newForm.OrderID := OrderID; newForm.OrderID := OrderID;
newForm.JobName := wdbtcOrders.Cells[3, row]; newForm.JobName := wdbtcOrders.Cells[3, row];
if wdbtcOrders.Cells[14, row] <> '' then if wdbtcOrders.Cells[14, row] <> '' then
...@@ -656,52 +729,52 @@ begin ...@@ -656,52 +729,52 @@ begin
end); end);
PageItem.appendChild(PageLink); PageItem.appendChild(PageLink);
PaginationElement.appendChild(PageItem); PaginationElement.appendChild(PageItem);
end; end;
procedure TFViewOrders.GetOrders(searchOptions: string); procedure TFViewOrders.GetOrders(searchOptions: string);
// retrieves a list of orders that fit a given search criteria
// searchOptions: search info to be sent to the server
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
orderList: TJSObject; orderList: TJSObject;
orderListLength: integer; orderListLength, TotalPages: Integer;
TotalPages: integer;
begin begin
Utils.ShowSpinner('spinner'); Utils.ShowSpinner('spinner');
if PageNumber > 0 then try
begin try
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetOrders', [searchOptions])); xdcResponse := await(XDataWebClient1.RawInvokeAsync(
orderList := TJSObject(xdcResponse.Result); 'ILookupService.GetOrders', [searchOptions]));
// Load data into the dataset if Assigned(xdcResponse.Result) then
xdwdsOrders.Close; begin
xdwdsOrders.SetJsonData(orderList['data']); orderList := TJSObject(xdcResponse.Result);
xdwdsOrders.Open; xdwdsOrders.Close;
xdwdsOrders.SetJsonData(orderList['data']);
xdwdsOrders.Open;
orderListLength := integer(orderList['count']); orderListLength := Integer(orderList['count']);
TotalPages := ( (orderListLength + PageSize - 1) div PageSize); TotalPages := (orderListLength + PageSize - 1) div PageSize;
GeneratePagination(TotalPages);
if orderListLength = 0 then // Update label
begin if orderListLength = 0 then
lblEntries.Caption := 'No entries found'; begin
end lblEntries.Caption := 'No entries found';
else if (PageNumber * PageSize) < orderListLength then ShowToast('No entries found', 'danger');
begin end
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + else if (PageNumber * PageSize) < orderListLength then
' - ' + IntToStr(PageNumber * PageSize) + lblEntries.Caption := Format('Showing entries %d - %d of %d',
' of ' + IntToStr(orderListLength); [(PageNumber - 1) * PageSize + 1, PageNumber * PageSize, orderListLength])
end else
else if (PageNumber * PageSize) >= orderListLength then lblEntries.Caption := Format('Showing entries %d - %d of %d',
begin [(PageNumber - 1) * PageSize + 1, orderListLength, orderListLength]);
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + end;
' - ' + IntToStr(orderListLength) +
' of ' + IntToStr(orderListLength);
end;
// Optional: Continue using pagination if needed except
GeneratePagination(TotalPages); on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve orders: ' + E.ErrorResult.ErrorMessage);
end;
finally
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
end; end;
end; end;
...@@ -713,20 +786,18 @@ begin ...@@ -713,20 +786,18 @@ begin
end; end;
procedure TFViewOrders.orderEntry(orderInfo, customerInfo, mode, orderType: string); procedure TFViewOrders.OrderEntry(orderInfo, customerInfo, mode, orderType: string);
begin begin
if orderType = 'corrugated' then if orderType = 'corrugated' then
FViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode, '') begin
FViewMain.ViewOrderEntryCorrugated(orderInfo, customerInfo, mode, '');
end
else if orderType = 'web' then else if orderType = 'web' then
FViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode, '') FViewMain.ViewOrderEntryWeb(orderInfo, customerInfo, mode, '')
else else
FViewMain.ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode, ''); FViewMain.ViewOrderEntryCuttingDie(orderInfo, customerInfo, mode, '');
end; end;
procedure TFViewOrders.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification();
end;
procedure TFViewOrders.btnSearchClick(Sender: TObject); procedure TFViewOrders.btnSearchClick(Sender: TObject);
var var
...@@ -799,39 +870,5 @@ begin ...@@ -799,39 +870,5 @@ begin
end; end;
procedure TFViewOrders.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
info := '';
end;
procedure TFViewOrders.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end;
end. end.
...@@ -231,6 +231,7 @@ object FSearch: TFSearch ...@@ -231,6 +231,7 @@ object FSearch: TFSearch
TabStop = False TabStop = False
Text = 'PROOF DONE' Text = 'PROOF DONE'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = wcbFilterType1Change
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
'NONE' 'NONE'
...@@ -365,6 +366,7 @@ object FSearch: TFSearch ...@@ -365,6 +366,7 @@ object FSearch: TFSearch
TabStop = False TabStop = False
Text = 'PROOF DONE' Text = 'PROOF DONE'
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = wcbFilterType2Change
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
'NONE' 'NONE'
......
...@@ -64,6 +64,8 @@ type ...@@ -64,6 +64,8 @@ type
procedure btnClearClick(Sender: TObject); procedure btnClearClick(Sender: TObject);
procedure cbNull1Click(Sender: TObject); procedure cbNull1Click(Sender: TObject);
procedure cbNull2Click(Sender: TObject); procedure cbNull2Click(Sender: TObject);
procedure wcbFilterType1Change(Sender: TObject);
procedure wcbFilterType2Change(Sender: TObject);
private private
//FJSONProc: TJSONProc; //FJSONProc: TJSONProc;
[async] procedure getCustomers; [async] procedure getCustomers;
...@@ -118,8 +120,8 @@ begin ...@@ -118,8 +120,8 @@ begin
DateFormatSettings.ShortDateFormat := 'yyyy/mm/dd'; DateFormatSettings.ShortDateFormat := 'yyyy/mm/dd';
wcbOrderType.Text := UpperCase(Copy(params.Values['orderType'], 1, 1)) + LowerCase(Copy(params.Values['orderType'], 2, MaxInt)); wcbOrderType.Text := UpperCase(Copy(params.Values['orderType'], 1, 1)) + LowerCase(Copy(params.Values['orderType'], 2, MaxInt));
edtOrderID.Text := params.Values['orderID']; edtOrderID.Text := params.Values['orderID'];
edtCompanyID.Text := params.Values['companyID'];
edtJobName.Text := params.Values['jobName']; edtJobName.Text := params.Values['jobName'];
DBID := params.Values['companyID'];
// Status 1 // Status 1
if params.Values['filterType1'] <> '' then if params.Values['filterType1'] <> '' then
...@@ -175,9 +177,9 @@ begin ...@@ -175,9 +177,9 @@ begin
end; end;
end; end;
getCustomers();
params.Free; params.Free;
getCustomers();
end; end;
procedure TFSearch.btnCancelClick(Sender: TObject); procedure TFSearch.btnCancelClick(Sender: TObject);
...@@ -257,6 +259,13 @@ begin ...@@ -257,6 +259,13 @@ begin
// Manually populate the grid // Manually populate the grid
PopulateGridManually; PopulateGridManually;
if DBID <> '' then
begin
xdwdsCustomers.Locate('CUSTOMER_ID', DBID, []);
edtCompanyID.Text := xdwdsCustomers.FieldByName('SHORT_NAME').AsString;
edtCompanyName.Text := xdwdsCustomers.FieldByName('NAME').AsString;
end;
end; end;
procedure TFSearch.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer); procedure TFSearch.TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
...@@ -267,6 +276,39 @@ begin ...@@ -267,6 +276,39 @@ begin
end; end;
procedure TFSearch.wcbFilterType1Change(Sender: TObject);
begin
if wcbFilterType1.Text = 'NONE' then
begin
dtpStartDate1.Visible := false;
dtpEndDate1.Visible := false;
cbNull1.Visible := false;
end
else
begin
dtpStartDate1.Visible := True;
dtpEndDate1.Visible := True;
cbNull1.Visible := True;
end;
end;
procedure TFSearch.wcbFilterType2Change(Sender: TObject);
begin
if wcbFilterType2.Text = 'NONE' then
begin
dtpStartDate2.Visible := false;
dtpEndDate2.Visible := false;
cbNull2.Visible := false;
end
else
begin
dtpStartDate2.Visible := True;
dtpEndDate2.Visible := True;
cbNull2.Visible := True;
end;
end;
procedure TFSearch.PopulateGridManually; procedure TFSearch.PopulateGridManually;
var var
RowIndex: Integer; RowIndex: Integer;
......
object FSelectCustomer: TFSelectCustomer object FSelectCustomer: TFSelectCustomer
Width = 765 Width = 765
Height = 480 Height = 416
OnCreate = WebFormCreate OnCreate = WebFormCreate
OnShow = WebFormShow OnShow = WebFormShow
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 8 Left = 8
Top = 81 Top = 27
Width = 95 Width = 95
Height = 15 Height = 15
Caption = 'Search Customers' Caption = 'Search Customers'
...@@ -14,7 +14,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -14,7 +14,7 @@ object FSelectCustomer: TFSelectCustomer
end end
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 279 Left = 279
Top = 81 Top = 27
Width = 134 Width = 134
Height = 15 Height = 15
Caption = 'Selected Customer Name' Caption = 'Selected Customer Name'
...@@ -23,7 +23,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -23,7 +23,7 @@ object FSelectCustomer: TFSelectCustomer
end end
object WebLabel3: TWebLabel object WebLabel3: TWebLabel
Left = 131 Left = 131
Top = 81 Top = 27
Width = 113 Width = 113
Height = 15 Height = 15
Caption = 'Selected Customer ID' Caption = 'Selected Customer ID'
...@@ -32,16 +32,17 @@ object FSelectCustomer: TFSelectCustomer ...@@ -32,16 +32,17 @@ object FSelectCustomer: TFSelectCustomer
end end
object edtSearch: TWebEdit object edtSearch: TWebEdit
Left = 4 Left = 4
Top = 102 Top = 48
Width = 121 Width = 121
Height = 22 Height = 22
ChildOrder = 2 ChildOrder = 2
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtSearchChange
end end
object edtName: TWebEdit object edtName: TWebEdit
Left = 279 Left = 279
Top = 102 Top = 48
Width = 142 Width = 142
Height = 22 Height = 22
ChildOrder = 1 ChildOrder = 1
...@@ -51,7 +52,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -51,7 +52,7 @@ object FSelectCustomer: TFSelectCustomer
end end
object TMSFNCGrid1: TTMSFNCGrid object TMSFNCGrid1: TTMSFNCGrid
Left = 0 Left = 0
Top = 163 Top = 99
Width = 765 Width = 765
Height = 317 Height = 317
Align = alBottom Align = alBottom
...@@ -205,20 +206,22 @@ object FSelectCustomer: TFSelectCustomer ...@@ -205,20 +206,22 @@ object FSelectCustomer: TFSelectCustomer
ScrollMode = scmItemScrolling ScrollMode = scmItemScrolling
DesignTimeSampleData = True DesignTimeSampleData = True
OnCellClick = TMSFNCGrid1CellClick OnCellClick = TMSFNCGrid1CellClick
ExplicitTop = 163
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 556 Left = 556
Top = 101 Top = 47
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
ChildOrder = 5 ChildOrder = 5
HeightPercent = 100.000000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 440 Left = 440
Top = 101 Top = 47
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Select' Caption = 'Select'
...@@ -227,30 +230,9 @@ object FSelectCustomer: TFSelectCustomer ...@@ -227,30 +230,9 @@ object FSelectCustomer: TFSelectCustomer
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick OnClick = btnConfirmClick
end end
object edtNotification: TWebEdit
Left = 4
Top = 16
Width = 510
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clRed
Font.Height = -13
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtID: TWebEdit object edtID: TWebEdit
Left = 131 Left = 131
Top = 102 Top = 48
Width = 142 Width = 142
Height = 22 Height = 22
ChildOrder = 1 ChildOrder = 1
......
<html> <div id="spinner" class="position-absolute top-50 start-50 translate-middle d-none">
<head> <div class="lds-roller">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <div></div><div></div><div></div><div></div>
<title>TMS Web Project</title> <div></div><div></div><div></div><div></div>
<style> </div>
</style> </div>
</head>
<body>
</body>
</html>
\ No newline at end of file
...@@ -21,7 +21,6 @@ type ...@@ -21,7 +21,6 @@ type
TMSFNCGrid1: TTMSFNCGrid; TMSFNCGrid1: TTMSFNCGrid;
btnCancel: TWebButton; btnCancel: TWebButton;
btnConfirm: TWebButton; btnConfirm: TWebButton;
edtNotification: TWebEdit;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
xdwdsCustomers: TXDataWebDataSet; xdwdsCustomers: TXDataWebDataSet;
wdsCustomers: TWebDataSource; wdsCustomers: TWebDataSource;
...@@ -46,11 +45,14 @@ type ...@@ -46,11 +45,14 @@ type
procedure TMSFNCGrid1CellDblClick(Sender: TObject; ACol, ARow: Integer); procedure TMSFNCGrid1CellDblClick(Sender: TObject; ACol, ARow: Integer);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer); procedure TMSFNCGrid1CellClick(Sender: TObject; ACol, ARow: Integer);
procedure edtSearchChange(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
[Async] procedure GetCustomers(); [Async] procedure GetCustomers();
[Async] procedure SendCustomerToServer(); [Async] procedure SendCustomerToServer();
procedure PopulateGridManually(); procedure PopulateGridManually();
procedure ApplyFilter();
public public
{ Public declarations } { Public declarations }
end; end;
...@@ -75,14 +77,18 @@ end; ...@@ -75,14 +77,18 @@ end;
procedure TFSelectCustomer.WebFormShow(Sender: TObject); procedure TFSelectCustomer.WebFormShow(Sender: TObject);
begin begin
Utils.ShowSpinner('spinner');
getCustomers(); getCustomers();
end; end;
procedure TFSelectCustomer.btnCancelClick(Sender: TObject);
begin
Close();
end;
procedure TFSelectCustomer.btnConfirmClick(Sender: TObject); procedure TFSelectCustomer.btnConfirmClick(Sender: TObject);
begin begin
if edtID.Text = '' then if edtID.Text = '' then
edtNotification.Text := 'Please Select a Customer' ShowToast('Please Select a Customer', 'danger')
else else
begin begin
xdwdsCustomers.Locate('Id', edtID.Text, []); xdwdsCustomers.Locate('Id', edtID.Text, []);
...@@ -90,29 +96,38 @@ begin ...@@ -90,29 +96,38 @@ begin
end; end;
end; end;
[async] procedure TFSelectCustomer.getCustomers(); procedure TFSelectCustomer.edtSearchChange(Sender: TObject);
begin
ApplyFilter();
end;
procedure TFSelectCustomer.getCustomers();
// retrieves customer list from server // retrieves customer list from server
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
customerList: TJSObject; customerList: TJSObject;
i: integer; i: integer;
begin begin
// Fetch data from XData service try
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.getQBCustomers', [])); Utils.ShowSpinner('spinner');
customerList := TJSObject(xdcResponse.Result); // Fetch data from XData service
//console.log(customerList); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.getQBCustomers', []));
customerList := TJSObject(xdcResponse.Result);
// Load data into TXDataWebDataset
// Load data into TXDataWebDataset
xdwdsCustomers.Close; xdwdsCustomers.Close;
xdwdsCustomers.SetJsonData(customerList); xdwdsCustomers.SetJsonData(customerList);
xdwdsCustomers.Open; xdwdsCustomers.Open;
// Manually populate the grid // Manually populate the grid
PopulateGridManually; PopulateGridManually;
Utils.HideSpinner('spinner'); except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve QuickBooks customers: ' + E.ErrorResult.ErrorMessage);
end;
end; end;
procedure TFSelectCustomer.PopulateGridManually; procedure TFSelectCustomer.PopulateGridManually;
// populates the grid with customers manually. // populates the grid with customers manually.
var var
...@@ -148,6 +163,7 @@ begin ...@@ -148,6 +163,7 @@ begin
finally finally
TMSFNCGrid1.EndUpdate; TMSFNCGrid1.EndUpdate;
end; end;
Utils.HideSpinner('spinner');
end; end;
procedure TFSelectCustomer.TMSFNCGrid1CellClick(Sender: TObject; ACol, procedure TFSelectCustomer.TMSFNCGrid1CellClick(Sender: TObject; ACol,
...@@ -202,4 +218,35 @@ begin ...@@ -202,4 +218,35 @@ begin
end; end;
procedure TFSelectCustomer.ApplyFilter;
// filters the grid based on search textbox contents.
var
fd: TTMSFNCGridFilterData;
i: Integer;
SearchText: string;
begin
SearchText := Trim(edtSearch.Text);
TMSFNCGrid1.RemoveFilter;
TMSFNCGrid1.Filter.Clear;
// match on first 3 columns
for i := 0 to 2 do
begin
fd := TMSFNCGrid1.Filter.Add;
fd.Column := i;
fd.Condition := '*' + SearchText + '*'; // Match text anywhere in the cell
fd.CaseSensitive := False; // Make the filter case-insensitive
// Use foOR for "match any column" logic
if i > 0 then
fd.Operation := foOR
else
fd.Operation := foNONE; // First filter has no logical operation
end;
// Apply the filters to the grid
TMSFNCGrid1.ApplyFilter;
end;
end. end.
\ No newline at end of file
object FSetStatus: TFSetStatus object FSetStatus: TFSetStatus
Width = 640 Width = 640
Height = 361 Height = 278
OnShow = WebFormShow OnShow = WebFormShow
object lblStatus1: TWebLabel object lblStatus1: TWebLabel
Left = 326 Left = 328
Top = 80 Top = 32
Width = 38 Width = 38
Height = 14 Height = 14
Caption = 'Status:' Caption = 'Status:'
...@@ -18,8 +18,8 @@ object FSetStatus: TFSetStatus ...@@ -18,8 +18,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 484 Left = 486
Top = 80 Top = 32
Width = 91 Width = 91
Height = 14 Height = 14
Caption = 'Date Completed:' Caption = 'Date Completed:'
...@@ -33,8 +33,8 @@ object FSetStatus: TFSetStatus ...@@ -33,8 +33,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 14 Left = 16
Top = 80 Top = 32
Width = 48 Width = 48
Height = 14 Height = 14
Caption = 'Order ID:' Caption = 'Order ID:'
...@@ -48,8 +48,8 @@ object FSetStatus: TFSetStatus ...@@ -48,8 +48,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel3: TWebLabel object WebLabel3: TWebLabel
Left = 172 Left = 174
Top = 78 Top = 30
Width = 57 Width = 57
Height = 14 Height = 14
Caption = 'Job Name:' Caption = 'Job Name:'
...@@ -63,8 +63,8 @@ object FSetStatus: TFSetStatus ...@@ -63,8 +63,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel4: TWebLabel object WebLabel4: TWebLabel
Left = 11 Left = 13
Top = 142 Top = 94
Width = 51 Width = 51
Height = 14 Height = 14
Caption = 'Ship Due:' Caption = 'Ship Due:'
...@@ -78,8 +78,8 @@ object FSetStatus: TFSetStatus ...@@ -78,8 +78,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel5: TWebLabel object WebLabel5: TWebLabel
Left = 169 Left = 171
Top = 142 Top = 94
Width = 78 Width = 78
Height = 14 Height = 14
Caption = 'New Due Date:' Caption = 'New Due Date:'
...@@ -93,8 +93,8 @@ object FSetStatus: TFSetStatus ...@@ -93,8 +93,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblMount: TWebLabel object lblMount: TWebLabel
Left = 324 Left = 326
Top = 200 Top = 152
Width = 62 Width = 62
Height = 14 Height = 14
Caption = 'Mount Due:' Caption = 'Mount Due:'
...@@ -108,8 +108,8 @@ object FSetStatus: TFSetStatus ...@@ -108,8 +108,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblMountNew: TWebLabel object lblMountNew: TWebLabel
Left = 482 Left = 484
Top = 200 Top = 152
Width = 78 Width = 78
Height = 14 Height = 14
Caption = 'New Due Date:' Caption = 'New Due Date:'
...@@ -123,8 +123,8 @@ object FSetStatus: TFSetStatus ...@@ -123,8 +123,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblPlate: TWebLabel object lblPlate: TWebLabel
Left = 11 Left = 13
Top = 200 Top = 152
Width = 54 Width = 54
Height = 14 Height = 14
Caption = 'Plate Due:' Caption = 'Plate Due:'
...@@ -138,8 +138,8 @@ object FSetStatus: TFSetStatus ...@@ -138,8 +138,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblPlateNew: TWebLabel object lblPlateNew: TWebLabel
Left = 169 Left = 171
Top = 200 Top = 152
Width = 78 Width = 78
Height = 14 Height = 14
Caption = 'New Due Date:' Caption = 'New Due Date:'
...@@ -153,8 +153,8 @@ object FSetStatus: TFSetStatus ...@@ -153,8 +153,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblArt: TWebLabel object lblArt: TWebLabel
Left = 324 Left = 326
Top = 142 Top = 94
Width = 44 Width = 44
Height = 14 Height = 14
Caption = 'Art Due:' Caption = 'Art Due:'
...@@ -168,8 +168,8 @@ object FSetStatus: TFSetStatus ...@@ -168,8 +168,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object lblArtNew: TWebLabel object lblArtNew: TWebLabel
Left = 482 Left = 484
Top = 142 Top = 94
Width = 78 Width = 78
Height = 14 Height = 14
Caption = 'New Due Date:' Caption = 'New Due Date:'
...@@ -183,8 +183,8 @@ object FSetStatus: TFSetStatus ...@@ -183,8 +183,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object wlcbStatus: TWebLookupComboBox object wlcbStatus: TWebLookupComboBox
Left = 326 Left = 328
Top = 100 Top = 52
Width = 145 Width = 145
Height = 22 Height = 22
ElementClassName = 'custom-select' ElementClassName = 'custom-select'
...@@ -194,8 +194,8 @@ object FSetStatus: TFSetStatus ...@@ -194,8 +194,8 @@ object FSetStatus: TFSetStatus
LookupValues = <> LookupValues = <>
end end
object dtpDate: TWebDateTimePicker object dtpDate: TWebDateTimePicker
Left = 484 Left = 486
Top = 100 Top = 52
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -206,8 +206,8 @@ object FSetStatus: TFSetStatus ...@@ -206,8 +206,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 14 Left = 16
Top = 273 Top = 225
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Confirm' Caption = 'Confirm'
...@@ -222,8 +222,8 @@ object FSetStatus: TFSetStatus ...@@ -222,8 +222,8 @@ object FSetStatus: TFSetStatus
OnClick = btnConfirmClick OnClick = btnConfirmClick
end end
object btnCancel: TWebButton object btnCancel: TWebButton
Left = 125 Left = 127
Top = 273 Top = 225
Width = 96 Width = 96
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
...@@ -238,8 +238,8 @@ object FSetStatus: TFSetStatus ...@@ -238,8 +238,8 @@ object FSetStatus: TFSetStatus
OnClick = btnCancelClick OnClick = btnCancelClick
end end
object edtOrderID: TWebEdit object edtOrderID: TWebEdit
Left = 14 Left = 16
Top = 100 Top = 52
Width = 145 Width = 145
Height = 22 Height = 22
HelpType = htKeyword HelpType = htKeyword
...@@ -259,31 +259,9 @@ object FSetStatus: TFSetStatus ...@@ -259,31 +259,9 @@ object FSetStatus: TFSetStatus
TabOrder = 1 TabOrder = 1
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object edtNotification: TWebEdit
Left = 14
Top = 24
Width = 457
Height = 22
HelpType = htKeyword
TabStop = False
ChildOrder = 8
ElementClassName = 'form-control'
ElementFont = efCSS
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -8
Font.Name = 'Arial'
Font.Style = []
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
TabOrder = 1
WidthPercent = 100.000000000000000000
end
object edtJobName: TWebEdit object edtJobName: TWebEdit
Left = 172 Left = 174
Top = 100 Top = 52
Width = 145 Width = 145
Height = 22 Height = 22
HelpType = htKeyword HelpType = htKeyword
...@@ -304,8 +282,8 @@ object FSetStatus: TFSetStatus ...@@ -304,8 +282,8 @@ object FSetStatus: TFSetStatus
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
end end
object dtpShipDue: TWebDateTimePicker object dtpShipDue: TWebDateTimePicker
Left = 11 Left = 13
Top = 162 Top = 114
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -317,8 +295,8 @@ object FSetStatus: TFSetStatus ...@@ -317,8 +295,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpNewShipDue: TWebDateTimePicker object dtpNewShipDue: TWebDateTimePicker
Left = 169 Left = 171
Top = 162 Top = 114
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -329,8 +307,8 @@ object FSetStatus: TFSetStatus ...@@ -329,8 +307,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpMountDue: TWebDateTimePicker object dtpMountDue: TWebDateTimePicker
Left = 324 Left = 326
Top = 220 Top = 172
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -342,8 +320,8 @@ object FSetStatus: TFSetStatus ...@@ -342,8 +320,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpNewMountDue: TWebDateTimePicker object dtpNewMountDue: TWebDateTimePicker
Left = 482 Left = 484
Top = 220 Top = 172
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -354,8 +332,8 @@ object FSetStatus: TFSetStatus ...@@ -354,8 +332,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpPlateDue: TWebDateTimePicker object dtpPlateDue: TWebDateTimePicker
Left = 11 Left = 13
Top = 220 Top = 172
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -367,8 +345,8 @@ object FSetStatus: TFSetStatus ...@@ -367,8 +345,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpNewPlateDue: TWebDateTimePicker object dtpNewPlateDue: TWebDateTimePicker
Left = 169 Left = 171
Top = 220 Top = 172
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -379,8 +357,8 @@ object FSetStatus: TFSetStatus ...@@ -379,8 +357,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpArtDue: TWebDateTimePicker object dtpArtDue: TWebDateTimePicker
Left = 324 Left = 326
Top = 162 Top = 114
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
...@@ -392,8 +370,8 @@ object FSetStatus: TFSetStatus ...@@ -392,8 +370,8 @@ object FSetStatus: TFSetStatus
Text = '' Text = ''
end end
object dtpNewArtDue: TWebDateTimePicker object dtpNewArtDue: TWebDateTimePicker
Left = 482 Left = 484
Top = 162 Top = 114
Width = 145 Width = 145
Height = 22 Height = 22
BorderStyle = bsSingle BorderStyle = bsSingle
......
...@@ -5,7 +5,7 @@ interface ...@@ -5,7 +5,7 @@ interface
uses uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls, System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.ExtCtrls, WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.ExtCtrls,
WEBLib.StdCtrls; WEBLib.StdCtrls, Utils;
type type
TFSetStatus = class(TWebForm) TFSetStatus = class(TWebForm)
...@@ -17,7 +17,6 @@ type ...@@ -17,7 +17,6 @@ type
btnCancel: TWebButton; btnCancel: TWebButton;
WebLabel2: TWebLabel; WebLabel2: TWebLabel;
edtOrderID: TWebEdit; edtOrderID: TWebEdit;
edtNotification: TWebEdit;
edtJobName: TWebEdit; edtJobName: TWebEdit;
WebLabel3: TWebLabel; WebLabel3: TWebLabel;
WebLabel4: TWebLabel; WebLabel4: TWebLabel;
...@@ -41,8 +40,6 @@ type ...@@ -41,8 +40,6 @@ type
procedure btnCancelClick(Sender: TObject); procedure btnCancelClick(Sender: TObject);
private private
{ Private declarations } { Private declarations }
procedure HideNotification;
procedure ShowNotification(Notification: string);
public public
{ Public declarations } { Public declarations }
confirm: boolean; confirm: boolean;
...@@ -65,14 +62,15 @@ end; ...@@ -65,14 +62,15 @@ end;
procedure TFSetStatus.btnConfirmClick(Sender: TObject); procedure TFSetStatus.btnConfirmClick(Sender: TObject);
begin begin
if ( (dtpDate.Date = 0 ) or ( wlcbStatus.value = '' ) ) then if ( (dtpDate.Date = 0 ) or ( wlcbStatus.value = '' ) ) then
ShowNotification('Failure:Please fill in all information') ShowToast('Failure: Please fill in all information')
else if ( ( OrderType = 'web plate' ) and ( wlcbStatus.Value = 'MOUNT' ) ) then else if ( ( OrderType = 'web plate' ) and ( wlcbStatus.Value = 'MOUNT' ) ) then
ShowNotification('Failure:Web Plate Orders do not have Mount Due/Done dates') ShowToast('Failure: Web Plate Orders do not have Mount Due/Done dates')
else if ( ( OrderType = 'cutting die' ) and ( wlcbStatus.Value = 'MOUNT' ) or ( wlcbStatus.Value = 'ART' ) or (wlcbStatus.Value = 'PLATE') ) then else if ( ( OrderType = 'cutting die' ) and ( wlcbStatus.Value = 'MOUNT' ) or ( wlcbStatus.Value = 'ART' ) or (wlcbStatus.Value = 'PLATE') ) then
ShowNotification('Failure:Cutting Die Orders do not have Art/Plate/Mount Due or Done Dates') ShowToast('Failure: Cutting Die Orders do not have Art/Plate/Mount Due or Done Dates')
else else
begin begin
confirm := true; confirm := true;
ShowToast('Success: Status updated!');
Close; Close;
end; end;
end; end;
...@@ -83,7 +81,6 @@ var ...@@ -83,7 +81,6 @@ var
i: integer; i: integer;
filteredItems: TJSArray; filteredItems: TJSArray;
begin begin
HideNotification();
edtOrderID.Text := OrderID; edtOrderID.Text := OrderID;
dtpDate.Date := 0; dtpDate.Date := 0;
edtJobName.Text := JobName; edtJobName.Text := JobName;
...@@ -137,17 +134,5 @@ begin ...@@ -137,17 +134,5 @@ begin
end; end;
end; end;
procedure TFSetStatus.HideNotification;
begin
//pnlMessage.ElementHandle.hidden := True;
end;
procedure TFSetStatus.ShowNotification(Notification: string);
begin
if Notification <> '' then
begin
edtNotification.Text := Notification;
end;
end;
end. end.
\ No newline at end of file
object FViewUserProfile: TFViewUserProfile object FViewUserProfile: TFViewUserProfile
Color = clWhite Width = 604
Height = 434
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -11 Font.Height = -11
Font.Name = 'Tahoma' Font.Name = 'Tahoma'
Font.Size = 8
Font.Style = [] Font.Style = []
FormStyle = fsNormal
Height = 434
Left = 0
OnShow = WebFormShow
ParentFont = False ParentFont = False
TabOrder = 0 OnShow = WebFormShow
Top = 0
Width = 604
object WebLabel1: TWebLabel object WebLabel1: TWebLabel
Left = 24
Top = 24
Width = 55
Height = 13
Caption = 'User Profile' Caption = 'User Profile'
ElementID = 'view.userprofile.title' ElementID = 'view.userprofile.title'
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -11 Font.Height = -11
Font.Name = 'Tahoma' Font.Name = 'Tahoma'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 16 HeightPercent = 100.000000000000000000
Left = 24 ParentFont = False
Top = 24
Visible = False Visible = False
Width = 54 WidthPercent = 100.000000000000000000
end end
object WebLabel3: TWebLabel object WebLabel3: TWebLabel
Left = 39
Top = 59
Width = 38
Height = 14
Caption = 'User ID:' Caption = 'User ID:'
ElementID = 'view.userprofile.form.lblUserID' ElementID = 'view.userprofile.form.lblUserID'
ElementPosition = epRelative ElementPosition = epRelative
...@@ -37,14 +37,16 @@ object FViewUserProfile: TFViewUserProfile ...@@ -37,14 +37,16 @@ object FViewUserProfile: TFViewUserProfile
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 16 HeightPercent = 100.000000000000000000
Left = 39 ParentFont = False
Top = 59 WidthPercent = 100.000000000000000000
Width = 40
end end
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 13
Top = 131
Width = 71
Height = 14
Caption = 'Email Address:' Caption = 'Email Address:'
ElementID = 'view.userprofile.form.lblEmail' ElementID = 'view.userprofile.form.lblEmail'
ElementPosition = epRelative ElementPosition = epRelative
...@@ -52,14 +54,16 @@ object FViewUserProfile: TFViewUserProfile ...@@ -52,14 +54,16 @@ object FViewUserProfile: TFViewUserProfile
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 16 HeightPercent = 100.000000000000000000
Left = 13 ParentFont = False
Top = 157 WidthPercent = 100.000000000000000000
Width = 70
end end
object WebLabel4: TWebLabel object WebLabel4: TWebLabel
Left = 29
Top = 83
Width = 52
Height = 14
Caption = 'Username:' Caption = 'Username:'
ElementID = 'view.userprofile.form.lblUserName' ElementID = 'view.userprofile.form.lblUserName'
ElementPosition = epRelative ElementPosition = epRelative
...@@ -67,60 +71,49 @@ object FViewUserProfile: TFViewUserProfile ...@@ -67,60 +71,49 @@ object FViewUserProfile: TFViewUserProfile
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 16 HeightPercent = 100.000000000000000000
Left = 29 ParentFont = False
Top = 83 WidthPercent = 100.000000000000000000
Width = 51
end end
object WebLabel5: TWebLabel object WebLabel5: TWebLabel
Caption = 'Full Name:'
ElementID = 'view.userprofile.form.lblFullName'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 16
Left = 29 Left = 29
Top = 107 Top = 107
Width = 51 Width = 49
end Height = 14
object WebLabel6: TWebLabel Caption = 'Full Name:'
Caption = 'Phone Number:' ElementID = 'view.userprofile.form.lblFullName'
ElementID = 'view.userprofile.form.lblPhone'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 16 HeightPercent = 100.000000000000000000
Left = 5 ParentFont = False
Top = 133 WidthPercent = 100.000000000000000000
Width = 74
end end
object lblResult: TWebLabel object lblResult: TWebLabel
Left = 85
Top = 246
Width = 3
Height = 14
ElementID = 'view.userprofile.form.lblresult' ElementID = 'view.userprofile.form.lblresult'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 13 HeightPercent = 100.000000000000000000
Left = 85 ParentFont = False
Top = 246 WidthPercent = 100.000000000000000000
Width = 3
end end
object edtUsername: TWebEdit object edtUsername: TWebEdit
Alignment = taLeftJustify Left = 85
Color = clWindow Top = 80
Width = 121
Height = 21
ElementID = 'view.userprofile.form.edtUsername' ElementID = 'view.userprofile.form.edtUsername'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False Enabled = False
...@@ -128,20 +121,18 @@ object FViewUserProfile: TFViewUserProfile ...@@ -128,20 +121,18 @@ object FViewUserProfile: TFViewUserProfile
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 21 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
Left = 85 ParentFont = False
ReadOnly = True ReadOnly = True
ShowFocus = True WidthPercent = 100.000000000000000000
TabOrder = 0
Top = 80
Width = 121
end end
object edtUserId: TWebEdit object edtUserId: TWebEdit
Alignment = taLeftJustify Left = 85
Color = clWindow Top = 56
Width = 121
Height = 21
ElementID = 'view.userprofile.form.edtUserID' ElementID = 'view.userprofile.form.edtUserID'
ElementPosition = epRelative ElementPosition = epRelative
Enabled = False Enabled = False
...@@ -149,58 +140,37 @@ object FViewUserProfile: TFViewUserProfile ...@@ -149,58 +140,37 @@ object FViewUserProfile: TFViewUserProfile
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 21 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
Left = 85 ParentFont = False
ReadOnly = True ReadOnly = True
ShowFocus = True
TabOrder = 1 TabOrder = 1
Top = 56 WidthPercent = 100.000000000000000000
Width = 121
end end
object edtFullName: TWebEdit object edtFullName: TWebEdit
Alignment = taLeftJustify
ChildOrder = 5
Color = clWindow
ElementID = 'view.userprofile.form.edtFullName'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 21
HideSelection = False
Left = 85 Left = 85
ShowFocus = True
TabOrder = 0
Top = 104 Top = 104
Width = 121 Width = 121
end Height = 21
object edtPhone: TWebEdit ChildOrder = 5
Alignment = taLeftJustify ElementID = 'view.userprofile.form.edtFullName'
ChildOrder = 7
Color = clWindow
ElementID = 'view.userprofile.form.edtPhone'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 21 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
Left = 85 ParentFont = False
ShowFocus = True WidthPercent = 100.000000000000000000
TabOrder = 0
Top = 128
Width = 121
end end
object chkAdminUser: TWebCheckBox object chkAdminUser: TWebCheckBox
Left = 85
Top = 179
Width = 113
Height = 22
Caption = 'chkAdminUser' Caption = 'chkAdminUser'
ChildOrder = 9 ChildOrder = 9
ElementID = 'view.userprofile.form.chkAdminUser' ElementID = 'view.userprofile.form.chkAdminUser'
...@@ -210,128 +180,72 @@ object FViewUserProfile: TFViewUserProfile ...@@ -210,128 +180,72 @@ object FViewUserProfile: TFViewUserProfile
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 22 HeightPercent = 100.000000000000000000
Left = 85 ParentFont = False
Role = 'null' Role = 'null'
ShowFocus = True WidthPercent = 100.000000000000000000
TabOrder = 0
Top = 179
Width = 113
end end
object edtEmail: TWebEdit object edtEmail: TWebEdit
Alignment = taLeftJustify Left = 85
Top = 126
Width = 121
Height = 21
ChildOrder = 7 ChildOrder = 7
Color = clWindow
ElementID = 'view.userprofile.form.edtEmail' ElementID = 'view.userprofile.form.edtEmail'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 21 HeightPercent = 100.000000000000000000
HideSelection = False HideSelection = False
Left = 85 ParentFont = False
ShowFocus = True WidthPercent = 100.000000000000000000
TabOrder = 0
Top = 152
Width = 121
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
Left = 85
Top = 210
Width = 96
Height = 25
Caption = 'Confirm Changes' Caption = 'Confirm Changes'
ChildOrder = 12 ChildOrder = 12
Color = clNone
ElementID = 'view.userprofile.form.btnconfirm' ElementID = 'view.userprofile.form.btnconfirm'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 25 HeightPercent = 100.000000000000000000
Left = 85 ParentFont = False
OnClick = btnConfirmClick
Role = 'button' Role = 'button'
TabOrder = 0 WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 208
Top = 210 Top = 210
Width = 96 Width = 96
end Height = 25
object WebButton1: TWebButton
Caption = 'Cancel Changes' Caption = 'Cancel Changes'
ChildOrder = 14 ChildOrder = 14
Color = clNone
ElementID = 'view.userprofile.form.btncancel' ElementID = 'view.userprofile.form.btncancel'
ElementPosition = epRelative ElementPosition = epRelative
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
Font.Color = clBlack Font.Color = clBlack
Font.Height = -11 Font.Height = -11
Font.Name = 'Arial' Font.Name = 'Arial'
Font.Size = 8
Font.Style = [] Font.Style = []
Height = 25 HeightPercent = 100.000000000000000000
Left = 208 ParentFont = False
OnClick = WebButton1Click
Role = 'button' Role = 'button'
TabOrder = 0 WidthPercent = 100.000000000000000000
Top = 210 OnClick = btnCancelClick
Width = 96
end
object pnlMessage: TWebPanel
ChildOrder = 17
Color = clBtnFace
ElementID = 'view.login.message'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 33
Left = 236
Role = 'null'
TabOrder = 8
TabStop = False
Top = 4
Width = 121
object lblMessage: TWebLabel
Caption = 'Message'
ElementID = 'view.login.message.label'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 16
Left = 16
Top = 11
Width = 43
end
object btnCloseNotification: TWebButton
ChildOrder = 1
Color = clNone
ElementID = 'view.login.message.button'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Size = 8
Font.Style = []
Height = 25
Left = 96
OnClick = btnCloseNotificationClick
Role = 'button'
TabOrder = 0
Top = 3
Width = 22
end
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 359 Left = 359
Top = 52 Top = 52
end end
......
<div class="row"> <div class="container">
<div class="col-lg-12"> <!-- Profile form -->
<div class="row"> <div class="row">
<div class=col-sm> <div class="col-lg-8 col-xl-6 mx-auto">
<div id="view.login.message" class="alert alert-danger"> <form id="userprofileform" class="needs-validation" role="form" autocomplete="off" novalidate>
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span> <div class="mb-3">
</div> <label id="view.userprofile.form.lblUserID"
for="view.userprofile.form.edtUserID"
class="form-label">User&nbsp;ID</label>
<input id="view.userprofile.form.edtUserID"
class="form-control"
readonly>
</div>
<div class="mb-3">
<label id="view.userprofile.form.lblUserName"
for="view.userprofile.form.edtUsername"
class="form-label">Username</label>
<input id="view.userprofile.form.edtUsername"
class="form-control"
required>
<div class="invalid-feedback">Username is required.</div>
</div>
<div class="mb-3">
<label id="view.userprofile.form.lblFullName"
for="view.userprofile.form.edtFullName"
class="form-label">Full&nbsp;Name</label>
<input id="view.userprofile.form.edtFullName"
class="form-control"
required>
<div class="invalid-feedback">Full Name is required.</div>
</div>
<div class="mb-3">
<label id="view.userprofile.form.lblEmail"
for="view.userprofile.form.edtEmail"
class="form-label">Email&nbsp;Address</label>
<input id="view.userprofile.form.edtEmail"
type="email"
class="form-control"
required>
<div class="invalid-feedback">Valid email is required.</div>
</div>
<div class="form-check mb-4">
<input type="checkbox"
id="view.userprofile.form.chkAdminUser"
class="form-check-input">
<label for="view.userprofile.form.chkAdminUser"
class="form-check-label">
Admin&nbsp;User
</label>
</div> </div>
<div role="form">
<div class="form-group"> <div class="d-flex gap-2 mb-4">
<label id="view.userprofile.form.lblUserID">User ID:</label> <button id="view.userprofile.form.btnconfirm"
<input id="view.userprofile.form.edtUserID" class="form-control"> class="btn btn-primary flex-grow-1"
</div> type="button">
<div class="form-group"> Confirm&nbsp;Changes
<label id="view.userprofile.form.lblUserName">Username:</label> </button>
<input id="view.userprofile.form.edtUsername" class="form-control"> <button id="view.userprofile.form.btncancel"
</div> class="btn btn-outline-secondary flex-grow-1"
<div class="form-group"> type="button">
<label id="view.userprofile.form.lblFullName">Full Name:</label> Cancel&nbsp;Changes
<input id="view.userprofile.form.edtFullName" class="form-control"> </button>
</div>
<div class="form-group">
<label id="view.userprofile.form.lblPhone">Phone Number:</label>
<input id="view.userprofile.form.edtPhone" class="form-control">
</div>
<div class="form-group">
<label id="view.userprofile.form.lblEmail">Email Address:</label>
<input id="view.userprofile.form.edtEmail" class="form-control">
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="view.userprofile.form.chkAdminUser">
<label class="custom-control-label" for="view.userprofile.form.chkAdminUser">Admin User</label>
</div>
<div class="form-group">
<button class="btn btn-primary" id="view.userprofile.form.btnconfirm">Confirm Changes</button>
<button class="btn btn-primary" id="view.userprofile.form.btncancel">Xancel Changes</button>
</div>
<div class="form-group">
<label id="view.userprofile.form.lblresult"></label>
</div>
</div> </div>
<label id="view.userprofile.form.lblresult" class="form-text"></label>
</form>
</div> </div>
</div>
</div> </div>
...@@ -6,7 +6,8 @@ uses ...@@ -6,7 +6,8 @@ uses
System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls, System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls,
XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset, XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset,
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, ConnectionModule; XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, ConnectionModule,
WEBLib.Toast;
type type
TFViewUserProfile = class(TWebForm) TFViewUserProfile = class(TWebForm)
...@@ -17,27 +18,18 @@ type ...@@ -17,27 +18,18 @@ type
edtUserId: TWebEdit; edtUserId: TWebEdit;
edtFullName: TWebEdit; edtFullName: TWebEdit;
WebLabel4: TWebLabel; WebLabel4: TWebLabel;
edtPhone: TWebEdit;
WebLabel5: TWebLabel; WebLabel5: TWebLabel;
chkAdminUser: TWebCheckBox; chkAdminUser: TWebCheckBox;
edtEmail: TWebEdit; edtEmail: TWebEdit;
WebLabel6: TWebLabel;
btnConfirm: TWebButton; btnConfirm: TWebButton;
lblResult: TWebLabel; lblResult: TWebLabel;
XDataWebClient1: TXDataWebClient; XDataWebClient1: TXDataWebClient;
WebButton1: TWebButton; btnCancel: TWebButton;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
procedure WebFormShow(Sender: TObject); procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject); procedure btnConfirmClick(Sender: TObject);
[async] procedure EditUser(); [async] procedure EditUser();
[async] procedure GetUser(); [async] procedure GetUser();
procedure WebButton1Click(Sender: TObject); procedure btnCancelClick(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
procedure btnCloseNotificationClick(Sender: TObject);
function CheckInputs(): boolean;
end; end;
var var
...@@ -47,81 +39,92 @@ implementation ...@@ -47,81 +39,92 @@ implementation
uses uses
Auth.Service, Auth.Service,
XData.Model.Classes; XData.Model.Classes,
Utils,
View.Main;
{$R *.dfm} {$R *.dfm}
procedure TFViewUserProfile.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
procedure TFViewUserProfile.btnConfirmClick(Sender: TObject); procedure TFViewUserProfile.btnConfirmClick(Sender: TObject);
var var
resultString: string; FormEl: TJSHTMLFormElement;
begin begin
asm FormEl := TJSHTMLFormElement(document.querySelector('form'));
var messageDiv = document.getElementById('view.login.message'); if not FormEl.checkValidity then
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
if CheckInputs() then
begin begin
EditUser(); FormEl.classList.add('was-validated');
end Exit;
end;
ShowConfirmationModal(
'Are you sure you want to save changes to your profile?',
'Save',
'Cancel',
procedure(confirmed: Boolean)
begin
if confirmed then
EditUser;
end
);
end; end;
procedure TFViewUserProfile.EditUser();
[async] procedure TFViewUserProfile.EditUser;
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
responseString: TJSObject; responseString: TJSObject;
editOptions: string; editOptions, resultMsg: string;
begin begin
if(checkInputs()) then try
begin
console.log(edtFullName.Text);
editOptions := '&username=' + edtUsername.Text + editOptions := '&username=' + edtUsername.Text +
'&fullname=' + edtFullName.Text + '&fullname=' + edtFullName.Text +
'&phonenumber=' + edtPhone.Text + '&email=' + edtEmail.Text;
'&email=' + edtEmail.Text;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.EditUser', [editOptions]));
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.EditUser', responseString := TJSObject(xdcResponse.Result);
[editOptions])); resultMsg := string(responseString['value']);
responseString := TJSObject(xdcResponse.Result);
asm Utils.ShowToast(resultMsg);
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger'); if resultMsg.ToLower.StartsWith('success:') then
messageDiv.classList.add('alert-success'); FViewMain.ViewOrders('');
end; except
ShowNotification(string(responseString['value'])); on E: EXDataClientRequestException do
Utils.ShowErrorModal('Error editing user: ' + E.ErrorResult.ErrorMessage);
on E: Exception do
Utils.ShowErrorModal('Unexpected error: ' + E.Message);
end; end;
end; end;
procedure TFViewUserProfile.WebButton1Click(Sender: TObject);
var procedure TFViewUserProfile.btnCancelClick(Sender: TObject);
xdcResponse: TXDataClientResponse;
userList: TJSObject;
data: TJSArray;
user: TJSObject;
begin begin
GetUser(); ShowConfirmationModal(
showNotification('Failure:Changes discarded'); 'Are you sure you want to cancel all your changes?',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
begin
GetUser();
ShowToast('Changes discarded', 'danger');
end;
end
);
end; end;
procedure TFViewUserProfile.WebFormShow(Sender: TObject); procedure TFViewUserProfile.WebFormShow(Sender: TObject);
var
xdcResponse: TXDataClientResponse;
userList: TJSObject;
data: TJSArray;
user: TJSObject;
begin begin
HideNotification;
GetUser(); GetUser();
//edtJwt.Text := TJSJSON.stringify(AuthService.TokenPayload); //edtJwt.Text := TJSJSON.stringify(AuthService.TokenPayload);
chkAdminUser.Checked := JS.toBoolean(AuthService.TokenPayload.Properties['user_admin']); // View.UserProfile.WebFormShow
chkAdminUser.Checked := SameText(string(AuthService.TokenPayload.Properties['user_admin']), 'true');
end; end;
procedure TFViewUserProfile.GetUser; procedure TFViewUserProfile.GetUser;
var var
xdcResponse: TXDataClientResponse; xdcResponse: TXDataClientResponse;
...@@ -129,139 +132,22 @@ var ...@@ -129,139 +132,22 @@ var
data: TJSArray; data: TJSArray;
user: TJSObject; user: TJSObject;
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetUsers', try
[JS.toString(AuthService.TokenPayload.Properties['user_name'])])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetUsers',
userList := TJSObject(xdcResponse.Result); [JS.toString(AuthService.TokenPayload.Properties['user_name'])]));
data := TJSArray(userList['data']); userList := TJSObject(xdcResponse.Result);
user := TJSObject(data[0]); data := TJSArray(userList['data']);
edtUsername.Text := string(user['username']); user := TJSObject(data[0]);
edtFullName.Text := string(user['full_name']); edtUsername.Text := string(user['username']);
edtPhone.Text := string(user['phone_number']); edtFullName.Text := string(user['full_name']);
edtEmail.Text := string(user['email_address']); edtEmail.Text := string(user['email_address']);
edtUserId.Text := string(user['userID']); edtUserId.Text := string(user['userID']);
chkAdminUser.Checked := boolean(user['admin']); chkAdminUser.Checked := boolean(user['admin']);
end; except
on E: EXDataClientRequestException do
procedure TFViewUserProfile.HideNotification; Utils.ShowErrorModal('Could not retrieve users: ' + E.ErrorResult.ErrorMessage);
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFViewUserProfile.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end; end;
end; end;
function TFViewUserProfile.CheckInputs(): boolean;
var
checkString: string;
charIndex: integer;
phoneNum: string;
begin
Result := false;
checkString := edtFullName.Text + edtUsername.Text + edtPhone.Text + edtEmail.Text;
if string(edtFullName.Text).IsEmpty then
begin
ShowNotification('Failure:Full Name field is blank!');
exit;
end;
if string(edtUsername.Text).IsEmpty then
begin
ShowNotification('Failure:Username field is blank!');
exit;
end;
if string(edtPhone.Text).IsEmpty then
begin
ShowNotification('Failure:Phone Number field is blank!');
exit;
end;
if string(edtEmail.Text).IsEmpty then
begin
ShowNotification('Failure:Email field is blank!');
exit;
end;
if checkString.Contains('&') then
begin
ShowNotification('Failure:No fields may contain "&&"!');
exit;
end;
if string(edtEmail.Text).Contains('@') = false then
begin
ShowNotification('Failure:Please enter a valid email address');
exit;
end;
if (length(string(edtEmail.Text).Split(['@'])) <> 2) or (string(edtEmail.text).CountChar('@') > 1) then
begin
ShowNotification('Failure:Please enter a valid email address');
exit;
end;
phoneNum := edtPhone.Text;
if (not phoneNum.Contains('(')) or (not phoneNum.Contains(')')) or (not phoneNum.Contains('-')) then
begin
ShowNotification('Failure:Please enter a valid phone number');
exit;
end;
if (phoneNum.CountChar('(') <> 1) or (phoneNum.CountChar(')') <> 1) or (phoneNum.CountChar('-') <> 1) or (phoneNum.CountChar(' ') > 1) then
begin
ShowNotification('Failure:Please enter a valid phone number');
exit;
end;
phoneNum := phoneNum.Replace('(', '');
phoneNum := phoneNum.Replace(')', '');
phoneNum := phoneNum.Replace('-', '');
phoneNum := phoneNum.Replace(' ', '');
console.log(phoneNum);
console.log(length(phoneNum));
if(length(phoneNum) <> 10) then
begin
ShowNotification('Failure:Please enter a valid phone number');
exit;
end;
for CharIndex := 1 to Length(phoneNum) do
begin
if not (phoneNum[CharIndex] in ['0' .. '9']) then
begin
console.log('here');
ShowNotification('Failure:Please enter a valid phone number');
exit;
end;
end;
result := true;
end;
end. end.
...@@ -45,36 +45,6 @@ object FViewUsers: TFViewUsers ...@@ -45,36 +45,6 @@ object FViewUsers: TFViewUsers
WidthPercent = 100.000000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnConfirmDeleteClick OnClick = btnConfirmDeleteClick
end end
object pnlMessage: TWebPanel
Left = 12
Top = 16
Width = 121
Height = 33
ElementID = 'view.login.message'
ChildOrder = 17
TabOrder = 2
object lblMessage: TWebLabel
Left = 16
Top = 11
Width = 46
Height = 15
Caption = 'Message'
ElementID = 'view.login.message.label'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object btnCloseNotification: TWebButton
Left = 96
Top = 3
Width = 22
Height = 25
ChildOrder = 1
ElementID = 'view.login.message.button'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnCloseNotificationClick
end
end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
Left = 462 Left = 462
......
...@@ -5,10 +5,6 @@ ...@@ -5,10 +5,6 @@
<div class="col-12 col-md-8"> <div class="col-12 col-md-8">
<div class="row"> <div class="row">
<div class=col-sm> <div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
<button id="view.login.message.button" type="button" class="btn-close" aria-label="Close"></button>
<span id="view.login.message.label"></span>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -47,22 +43,5 @@ ...@@ -47,22 +43,5 @@
</div> </div>
</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">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="confirmation_modal_label">Confirm</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Are you sure you want to make these changes?
</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_delete" >Confirm</button>
</div>
</div>
</div>
</div>
...@@ -6,7 +6,7 @@ uses ...@@ -6,7 +6,7 @@ uses
System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs, System.SysUtils, System.Classes, Web, WEBLib.Graphics, WEBLib.Forms, WEBLib.Dialogs,
Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids, WebLib.Lists, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls, WEBLib.Controls, WEBLib.Grids, WebLib.Lists,
XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset, XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset,
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, WEBLib.DBCtrls, JS; XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, WEBLib.DBCtrls, JS, Utils;
type type
TFViewUsers = class(TWebForm) TFViewUsers = class(TWebForm)
...@@ -16,9 +16,6 @@ type ...@@ -16,9 +16,6 @@ type
btnAddUser: TWebButton; btnAddUser: TWebButton;
WebDataSource1: TWebDataSource; WebDataSource1: TWebDataSource;
btnConfirmDelete: TWebButton; btnConfirmDelete: TWebButton;
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
XDataWebDataSet1userID: TStringField; XDataWebDataSet1userID: TStringField;
XDataWebDataSet1username: TStringField; XDataWebDataSet1username: TStringField;
XDataWebDataSet1full_name: TStringField; XDataWebDataSet1full_name: TStringField;
...@@ -34,7 +31,6 @@ type ...@@ -34,7 +31,6 @@ type
//AField: TField; AValue: string; AElement: TJSHTMLElementRecord); //AField: TField; AValue: string; AElement: TJSHTMLElementRecord);
procedure btnConfirmDeleteClick(Sender: TObject); procedure btnConfirmDeleteClick(Sender: TObject);
procedure btnAddUserClick(Sender: TObject); procedure btnAddUserClick(Sender: TObject);
procedure btnCloseNotificationClick(Sender: TObject);
//procedure btnApplyClick(Sender: TObject); //procedure btnApplyClick(Sender: TObject);
//procedure btnSearchClick(Sender: TObject); //procedure btnSearchClick(Sender: TObject);
private private
...@@ -46,8 +42,6 @@ type ...@@ -46,8 +42,6 @@ type
[async] procedure DelUser(username: string); [async] procedure DelUser(username: string);
[async] procedure EditUser(row: TJSHTMLElement); [async] procedure EditUser(row: TJSHTMLElement);
[async] procedure GetUsers(searchOptions: string); [async] procedure GetUsers(searchOptions: string);
procedure HideNotification;
procedure ShowNotification(Notification: string);
procedure AddRowToTable(UserID, Username, Password, Full_Name, Status, procedure AddRowToTable(UserID, Username, Password, Full_Name, Status,
Email, AType, PID, QBID: string; Rights: integer); Email, AType, PID, QBID: string; Rights: integer);
//[async] procedure addUser(); //[async] procedure addUser();
...@@ -98,10 +92,7 @@ begin ...@@ -98,10 +92,7 @@ begin
PageSize := 10; PageSize := 10;
GetUsers(''); GetUsers('');
if Info <> '' then if Info <> '' then
ShowNotification(Info) ShowToast(Info)
else
HideNotification();
end; end;
procedure TFViewUsers.DelUser(username: string); procedure TFViewUsers.DelUser(username: string);
...@@ -112,7 +103,7 @@ begin ...@@ -112,7 +103,7 @@ begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelUser', xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.DelUser',
[username])); [username]));
responseString := TJSObject(xdcResponse.Result); responseString := TJSObject(xdcResponse.Result);
ShowNotification(string(responseString['value'])); ShowToast(string(responseString['value']));
getUsers(''); getUsers('');
end; end;
...@@ -330,44 +321,50 @@ var ...@@ -330,44 +321,50 @@ var
data: TJSArray; data: TJSArray;
user: TJSObject; user: TJSObject;
userListLength: integer; userListLength: integer;
begin begin
if PageNumber > 0 then if PageNumber > 0 then
begin begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetUsers', Utils.ShowSpinner('spinner');
[searchOptions])); try
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.GetUsers',
userList := TJSObject(xdcResponse.Result); [searchOptions]));
data := TJSArray(userList['data']);
userListLength := integer(userList['count']); userList := TJSObject(xdcResponse.Result);
ClearTable(); data := TJSArray(userList['data']);
XDataWebDataSet1.Close; userListLength := integer(userList['count']);
XDataWebDataSet1.SetJsonData(userList['data']); ClearTable();
XDataWebDataSet1.Open; XDataWebDataSet1.Close;
for i := 0 to data.Length - 1 do XDataWebDataSet1.SetJsonData(userList['data']);
begin XDataWebDataSet1.Open;
user := TJSObject(data[i]); for i := 0 to data.Length - 1 do
AddRowToTable(XDataWebDataSet1userID.AsString, XDataWebDataSet1username.AsString, begin
XDataWebDataSet1password.AsString, XDataWebDataSet1full_name.AsString, user := TJSObject(data[i]);
XDataWebDataSet1status.AsString, XDataWebDataSet1email_address.AsString, AddRowToTable(XDataWebDataSet1userID.AsString, XDataWebDataSet1username.AsString,
XDataWebDataSet1Atype.AsString, XDataWebDataSet1perspectiveID.AsString, XDataWebDataSet1password.AsString, XDataWebDataSet1full_name.AsString,
XDataWebDataSet1QBID.AsString, XDataWebDataSet1rights.AsInteger); XDataWebDataSet1status.AsString, XDataWebDataSet1email_address.AsString,
XDataWebDataSet1.Next; XDataWebDataSet1Atype.AsString, XDataWebDataSet1perspectiveID.AsString,
end; XDataWebDataSet1QBID.AsString, XDataWebDataSet1rights.AsInteger);
TotalPages := (userListLength + PageSize - 1) div PageSize; XDataWebDataSet1.Next;
if (PageNumber * PageSize) < userListLength then end;
begin TotalPages := (userListLength + PageSize - 1) div PageSize;
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + if (PageNumber * PageSize) < userListLength then
' - ' + IntToStr(PageNumber * PageSize) + begin
' of ' + IntToStr(userListLength); lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
end ' - ' + IntToStr(PageNumber * PageSize) +
else ' of ' + IntToStr(userListLength);
begin end
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) + else
' - ' + IntToStr(userListLength) + begin
' of ' + IntToStr(userListLength); lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(userListLength) +
' of ' + IntToStr(userListLength);
end;
GeneratePagination(TotalPages);
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal('Could not retrieve users: ' + E.ErrorResult.ErrorMessage);
end; end;
GeneratePagination(TotalPages); Utils.HideSpinner('spinner');
end; end;
end; end;
...@@ -443,7 +440,7 @@ begin ...@@ -443,7 +440,7 @@ begin
Cell := TJSHTMLElement(document.createElement('td')); Cell := TJSHTMLElement(document.createElement('td'));
Cell.setAttribute('data-label', 'Edit'); Cell.setAttribute('data-label', 'Edit');
Button := TJSHTMLElement(document.createElement('a')); Button := TJSHTMLElement(document.createElement('a'));
Button.className := 'btn btn-primary'; Button.className := 'btn btn-sm btn-primary';
Button.innerHTML := '<i class="far fa-edit fa-fw"></i><span>Edit</span>'; Button.innerHTML := '<i class="far fa-edit fa-fw"></i><span>Edit</span>';
Button.addEventListener('click', procedure(Event: TJSMouseEvent) Button.addEventListener('click', procedure(Event: TJSMouseEvent)
begin begin
...@@ -462,43 +459,6 @@ begin ...@@ -462,43 +459,6 @@ begin
FViewMain.EditUser('Add', '', '', '', '', '', '', '', '', ''); FViewMain.EditUser('Add', '', '', '', '', '', '', '', '', '');
end; end;
procedure TFViewUsers.btnCloseNotificationClick(Sender: TObject);
begin
HideNotification;
end;
procedure TFViewUsers.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
end;
procedure TFViewUsers.ShowNotification(Notification: string);
var
splitNotification: TArray<string>;
begin
if Notification <> '' then
begin
splitNotification := Notification.Split([':']);
if(splitNotification[0] = 'Success') then
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-danger');
messageDiv.classList.add('alert-success');
end;
end
else
begin
asm
var messageDiv = document.getElementById('view.login.message');
messageDiv.classList.remove('alert-success');
messageDiv.classList.add('alert-danger');
end;
end;
lblMessage.Caption := splitNotification[1];
pnlMessage.ElementHandle.hidden := False;
end;
end;
procedure TFViewUsers.btnConfirmDeleteClick(Sender: TObject); procedure TFViewUsers.btnConfirmDeleteClick(Sender: TObject);
begin begin
......
...@@ -367,6 +367,30 @@ is-invalid .form-check-input { ...@@ -367,6 +367,30 @@ is-invalid .form-check-input {
} }
@keyframes slideInLeft {
from {
transform: translateX(-120%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.toast.slide-in {
animation: slideInLeft 0.4s ease-out forwards;
}
#spinner {
position: fixed !important;
z-index: 9999 !important;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
......
<html><head> <!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <html>
<meta content="width=device-width, initial-scale=1" name="viewport"/> <head>
<noscript>Your browser does not support JavaScript!</noscript> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="data:;base64,=" rel="icon"/> <meta content="width=device-width, initial-scale=1" name="viewport"/>
<title>Web KG Orders</title> <noscript>Your browser does not support JavaScript!</noscript>
<link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/css/flag-icon.min.css" rel="stylesheet"/> <link href="data:;base64,=" rel="icon"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet"/> <title>EM Systems webKGOrders App</title>
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/css/flag-icon.min.css" rel="stylesheet"/>
<script crossorigin="anonymous" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" src="https://code.jquery.com/jquery-3.7.1.js"></script> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<script src="$(ProjectName).js" type="text/javascript"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet"/>
<title>EM Systems webKGOrders App</title> <link href="css/app.css" rel="stylesheet" type="text/css"/>
<link href="css/app.css" rel="stylesheet" type="text/css"/> <link href="css/spinner.css" rel="stylesheet" type="text/css"/>
<link href="css/spinner.css" rel="stylesheet" type="text/css">
<script src="$(ProjectName).js" type="text/javascript"></script> <script crossorigin="anonymous" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" src="https://code.jquery.com/jquery-3.7.1.js"></script>
<body> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script>
</body> <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script type="text/javascript">rtl.run();</script> <script src="$(ProjectName).js" type="text/javascript"></script>
</head>
<body>
</body>
<script type="text/javascript">rtl.run();</script>
</html> </html>
program webKGOrders; program webKGOrders;
uses uses
...@@ -29,7 +28,8 @@ uses ...@@ -29,7 +28,8 @@ uses
AddCustomer in 'AddCustomer.pas' {FViewAddCustomer: TWebForm} {*.html}, AddCustomer in 'AddCustomer.pas' {FViewAddCustomer: TWebForm} {*.html},
View.AddAddress in 'View.AddAddress.pas' {FViewAddAddress: TWebForm} {*.html}, View.AddAddress in 'View.AddAddress.pas' {FViewAddAddress: TWebForm} {*.html},
View.SelectCustomer in 'View.SelectCustomer.pas' {FSelectCustomer: TWebForm} {*.html}, View.SelectCustomer in 'View.SelectCustomer.pas' {FSelectCustomer: TWebForm} {*.html},
Utils in 'Utils.pas'; Utils in 'Utils.pas',
View.AddItem in 'View.AddItem.pas' {fViewAddItem: TWebForm} {*.html};
{$R *.res} {$R *.res}
......
...@@ -69,9 +69,13 @@ ...@@ -69,9 +69,13 @@
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace> <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType> <BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys> <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=0.9.5.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.5.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File> <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_MinorVer>9</VerInfo_MinorVer>
<VerInfo_Release>5</VerInfo_Release>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''"> <PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_UsePackage>DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;emshosting;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage> <DCC_UsePackage>DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;IndyIPCommon;vcl;DBXSybaseASEDriver;IndyIPServer;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;emshosting;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
...@@ -90,13 +94,14 @@ ...@@ -90,13 +94,14 @@
<DCC_RemoteDebug>false</DCC_RemoteDebug> <DCC_RemoteDebug>false</DCC_RemoteDebug>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=0.9.2.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.2.0;Comments=;LastCompiledTime=2018/08/27 15:18:29</VerInfo_Keys> <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=0.9.5.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.5.0;Comments=;LastCompiledTime=2018/08/27 15:18:29</VerInfo_Keys>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode> <AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
<VerInfo_MajorVer>0</VerInfo_MajorVer> <VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_MinorVer>9</VerInfo_MinorVer> <VerInfo_MinorVer>9</VerInfo_MinorVer>
<TMSWebSingleInstance>1</TMSWebSingleInstance> <TMSWebSingleInstance>1</TMSWebSingleInstance>
<TMSUseJSDebugger>2</TMSUseJSDebugger> <TMSUseJSDebugger>2</TMSUseJSDebugger>
<VerInfo_Release>2</VerInfo_Release> <VerInfo_Release>5</VerInfo_Release>
<TMSWebBrowser>3</TMSWebBrowser>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''"> <PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
...@@ -107,11 +112,13 @@ ...@@ -107,11 +112,13 @@
<TMSWebDefines>RELEASE</TMSWebDefines> <TMSWebDefines>RELEASE</TMSWebDefines>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''"> <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Build>8</VerInfo_Build> <VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=0.9.6.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.6.0;Comments=;LastCompiledTime=2018/08/22 16:25:56</VerInfo_Keys>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.8;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;LastCompiledTime=2018/08/22 16:25:56</VerInfo_Keys>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Locale>1033</VerInfo_Locale>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode> <AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
<VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_MinorVer>9</VerInfo_MinorVer>
<VerInfo_Release>6</VerInfo_Release>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<DelphiCompile Include="$(MainSource)"> <DelphiCompile Include="$(MainSource)">
...@@ -206,6 +213,10 @@ ...@@ -206,6 +213,10 @@
<DesignClass>TWebForm</DesignClass> <DesignClass>TWebForm</DesignClass>
</DCCReference> </DCCReference>
<DCCReference Include="Utils.pas"/> <DCCReference Include="Utils.pas"/>
<DCCReference Include="View.AddItem.pas">
<Form>fViewAddItem</Form>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<None Include="index.html"/> <None Include="index.html"/>
<None Include="css\app.css"/> <None Include="css\app.css"/>
<None Include="config\config.json"/> <None Include="config\config.json"/>
......
...@@ -132,6 +132,7 @@ begin ...@@ -132,6 +132,7 @@ begin
JWT.Claims.SetClaimOfType<string>('user_email', userEmail); JWT.Claims.SetClaimOfType<string>('user_email', userEmail);
JWT.Claims.SetClaimOfType<string>('user_qb_id', userQBID); JWT.Claims.SetClaimOfType<string>('user_qb_id', userQBID);
JWT.Claims.SetClaimOfType<string>('user_access_type', userAccessType); JWT.Claims.SetClaimOfType<string>('user_access_type', userAccessType);
JWT.Claims.SetClaimOfType<string>('user_admin', LowerCase(BoolToStr(SameText(userAccessType, 'ALL'), True)));
Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT); Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT);
finally finally
......
...@@ -376,6 +376,100 @@ type ...@@ -376,6 +376,100 @@ type
general_special_instructions: string; general_special_instructions: string;
end; end;
// These objects are only used for quickbooks estimates.
TRef = record
value: string;
name: string; // optional
end;
TCustomerMemo = record
value: string;
end;
TAddress = record
Line1: string;
Line2: string; // optional
Line3: string; // optional
Line4: string; //optional
Line5: string; //optional
City: string;
CountrySubDivisionCode: string;
PostalCode: string;
Country: string; // optional
end;
TTaxCodeRef = record
value: string;
end;
TClassRef = record
value: string;
end;
TSalesItemLineDetail = record
ItemRef: TRef;
Qty: Double;
UnitPrice: Double;
TaxCodeRef: TTaxCodeRef; // optional
ClassRef: TClassRef; // optional
ServiceDate: string; // optional
end;
TLine = record
Id: string; // optional (auto-generated if omitted)
LineNum: Integer; // optional
Description: string; // optional
Amount: Double;
DetailType: string;
SalesItemLineDetail: TSalesItemLineDetail;
end;
TCustomField = record
DefinitionId: string;
Name: string;
Type_: string;
StringValue: string;
end;
TTxnTaxCodeRef = record
value: string;
end;
TTxnTaxDetail = record
TxnTaxCodeRef: TTxnTaxCodeRef;
TotalTax: Double;
end;
TEmail = record
Address: string;
end;
TEstimate = record
DocNumber: string; // optional
TxnDate: string;
PrivateNote: string; // optional
CustomerRef: TRef;
CustomerMemo: TCustomerMemo; // optional
BillAddr: TAddress; // optional
ShipAddr: TAddress; // optional
ShipMethodRef: TRef; // optional
SalesTermRef: TRef; // optional
DueDate: string; // optional
ClassRef: TRef; // optional
DepartmentRef: TRef; // optional
CurrencyRef: TRef; // optional
ExchangeRate: Double; // optional
EmailStatus: string; // optional
BillEmail: TEmail; // optional
ShipDate: string; // optional
TrackingNum: string; // optional
CustomerMsgRef: TRef; // optional
CustomField: TArray<TCustomField>; // optional
Line: TArray<TLine>;
TxnTaxDetail: TTxnTaxDetail; // optional
end;
type type
[ServiceContract, Model(API_MODEL)] [ServiceContract, Model(API_MODEL)]
...@@ -394,10 +488,11 @@ type ...@@ -394,10 +488,11 @@ type
[HttpGet] function GenerateOrderWebPDF(orderID: string): string; [HttpGet] function GenerateOrderWebPDF(orderID: string): string;
[HttpGet] function GenerateOrderCuttingPDF(orderID: string): string; [HttpGet] function GenerateOrderCuttingPDF(orderID: string): string;
[HttpGet] function getQBCustomers(): TJSONArray; [HttpGet] function getQBCustomers(): TJSONArray;
[HttpGet] function getQBItems(): TJSONArray;
function AddUser(userInfo: string): string; function AddUser(userInfo: string): string;
function AddItem(itemInfo: string): string; function AddItem(itemInfo: string): TJSONObject;
function AddShippingAddress(Addressinfo: string): TJSONObject; function AddShippingAddress(Addressinfo: string): TJSONObject;
function DelShippingAddress(AddressID, CustomerID: string): TJSONObject; function DelShippingAddress(AddressID, CustomerID: string): TJSONObject;
function DelUser(username: string): string; function DelUser(username: string): string;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,7 +16,7 @@ object FMain: TFMain ...@@ -16,7 +16,7 @@ object FMain: TFMain
597) 597)
TextHeight = 13 TextHeight = 13
object memoInfo: TMemo object memoInfo: TMemo
Left = 8 Left = 12
Top = 44 Top = 44
Width = 753 Width = 753
Height = 549 Height = 549
......
...@@ -2,8 +2,8 @@ object fQB: TfQB ...@@ -2,8 +2,8 @@ object fQB: TfQB
Left = 0 Left = 0
Top = 0 Top = 0
Caption = 'fQB' Caption = 'fQB'
ClientHeight = 711 ClientHeight = 661
ClientWidth = 962 ClientWidth = 982
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
...@@ -13,223 +13,458 @@ object fQB: TfQB ...@@ -13,223 +13,458 @@ object fQB: TfQB
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
TextHeight = 15 TextHeight = 15
object Memo1: TMemo object Splitter1: TSplitter
Left = 0 Left = 0
Top = 76 Top = 472
Width = 962 Width = 982
Height = 260 Height = 6
Cursor = crVSplit
Align = alBottom Align = alBottom
Lines.Strings = (
'Memo1')
ScrollBars = ssVertical
TabOrder = 0
end
object Button1: TButton
Left = 42
Top = 18
Width = 87
Height = 25
Caption = 'Company Info'
TabOrder = 1
OnClick = Button1Click
end end
object Memo2: TMemo object Splitter2: TSplitter
Left = 0 Left = 0
Top = 336 Top = 281
Width = 962 Width = 982
Height = 196 Height = 3
Cursor = crVSplit
Align = alBottom Align = alBottom
Lines.Strings = ( ExplicitTop = 0
'') ExplicitWidth = 284
ScrollBars = ssVertical
TabOrder = 2
end end
object Button2: TButton object Button2: TButton
Left = 135 Left = 4
Top = 22 Top = 32
Width = 87 Width = 111
Height = 25 Height = 25
Caption = 'Get Customers' Caption = 'Get QB Customers'
TabOrder = 3 TabOrder = 0
OnClick = Button2Click OnClick = Button2Click
end end
object asgData: TAdvStringGrid
Left = 0
Top = 532
Width = 962
Height = 179
Align = alBottom
DrawingStyle = gdsClassic
FixedColor = clWhite
TabOrder = 4
GridLineColor = 13948116
GridFixedLineColor = 11250603
ActiveCellFont.Charset = DEFAULT_CHARSET
ActiveCellFont.Color = 4474440
ActiveCellFont.Height = -12
ActiveCellFont.Name = 'Segoe UI'
ActiveCellFont.Style = [fsBold]
ActiveCellColor = 11565130
ActiveCellColorTo = 11565130
BorderColor = 11250603
ControlLook.FixedGradientFrom = clWhite
ControlLook.FixedGradientTo = clWhite
ControlLook.FixedGradientHoverFrom = clGray
ControlLook.FixedGradientHoverTo = clWhite
ControlLook.FixedGradientHoverMirrorFrom = clWhite
ControlLook.FixedGradientHoverMirrorTo = clWhite
ControlLook.FixedGradientHoverBorder = 11645361
ControlLook.FixedGradientDownFrom = clWhite
ControlLook.FixedGradientDownTo = clWhite
ControlLook.FixedGradientDownMirrorFrom = clWhite
ControlLook.FixedGradientDownMirrorTo = clWhite
ControlLook.FixedGradientDownBorder = 11250603
ControlLook.DropDownHeader.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownHeader.Font.Color = clWindowText
ControlLook.DropDownHeader.Font.Height = -11
ControlLook.DropDownHeader.Font.Name = 'Segoe UI'
ControlLook.DropDownHeader.Font.Style = []
ControlLook.DropDownHeader.Visible = True
ControlLook.DropDownHeader.Buttons = <>
ControlLook.DropDownFooter.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownFooter.Font.Color = clWindowText
ControlLook.DropDownFooter.Font.Height = -11
ControlLook.DropDownFooter.Font.Name = 'Segoe UI'
ControlLook.DropDownFooter.Font.Style = []
ControlLook.DropDownFooter.Visible = True
ControlLook.DropDownFooter.Buttons = <>
ControlLook.ToggleSwitch.BackgroundBorderWidth = 1.000000000000000000
ControlLook.ToggleSwitch.ButtonBorderWidth = 1.000000000000000000
ControlLook.ToggleSwitch.CaptionFont.Charset = DEFAULT_CHARSET
ControlLook.ToggleSwitch.CaptionFont.Color = clWindowText
ControlLook.ToggleSwitch.CaptionFont.Height = -12
ControlLook.ToggleSwitch.CaptionFont.Name = 'Segoe UI'
ControlLook.ToggleSwitch.CaptionFont.Style = []
ControlLook.ToggleSwitch.Shadow = False
Filter = <>
FilterDropDown.Font.Charset = DEFAULT_CHARSET
FilterDropDown.Font.Color = clWindowText
FilterDropDown.Font.Height = -12
FilterDropDown.Font.Name = 'Segoe UI'
FilterDropDown.Font.Style = []
FilterDropDown.TextChecked = 'Checked'
FilterDropDown.TextUnChecked = 'Unchecked'
FilterDropDownClear = '(All)'
FilterEdit.TypeNames.Strings = (
'Starts with'
'Ends with'
'Contains'
'Not contains'
'Equal'
'Not equal'
'Larger than'
'Smaller than'
'Clear')
FixedRowHeight = 22
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 3881787
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
FloatFormat = '%.2f'
HoverButtons.Buttons = <>
HTMLSettings.ImageFolder = 'images'
HTMLSettings.ImageBaseName = 'img'
Look = glCustom
PrintSettings.DateFormat = 'dd/mm/yyyy'
PrintSettings.Font.Charset = DEFAULT_CHARSET
PrintSettings.Font.Color = clWindowText
PrintSettings.Font.Height = -12
PrintSettings.Font.Name = 'Segoe UI'
PrintSettings.Font.Style = []
PrintSettings.FixedFont.Charset = DEFAULT_CHARSET
PrintSettings.FixedFont.Color = clWindowText
PrintSettings.FixedFont.Height = -12
PrintSettings.FixedFont.Name = 'Segoe UI'
PrintSettings.FixedFont.Style = []
PrintSettings.HeaderFont.Charset = DEFAULT_CHARSET
PrintSettings.HeaderFont.Color = clWindowText
PrintSettings.HeaderFont.Height = -12
PrintSettings.HeaderFont.Name = 'Segoe UI'
PrintSettings.HeaderFont.Style = []
PrintSettings.FooterFont.Charset = DEFAULT_CHARSET
PrintSettings.FooterFont.Color = clWindowText
PrintSettings.FooterFont.Height = -12
PrintSettings.FooterFont.Name = 'Segoe UI'
PrintSettings.FooterFont.Style = []
PrintSettings.PageNumSep = '/'
SearchFooter.ColorTo = clNone
SearchFooter.FindNextCaption = 'Find &next'
SearchFooter.FindPrevCaption = 'Find &previous'
SearchFooter.Font.Charset = DEFAULT_CHARSET
SearchFooter.Font.Color = clWindowText
SearchFooter.Font.Height = -12
SearchFooter.Font.Name = 'Segoe UI'
SearchFooter.Font.Style = []
SearchFooter.HighLightCaption = 'Highlight'
SearchFooter.HintClose = 'Close'
SearchFooter.HintFindNext = 'Find next occurrence'
SearchFooter.HintFindPrev = 'Find previous occurrence'
SearchFooter.HintHighlight = 'Highlight occurrences'
SearchFooter.MatchCaseCaption = 'Match case'
SearchFooter.ResultFormat = '(%d of %d)'
SelectionColor = 13744549
SortSettings.HeaderColor = clWhite
SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite
Version = '9.1.4.1'
ColWidths = (
64
64
64
64
64)
RowHeights = (
22
22
22
22
22
22
22
22
22
22)
end
object Button3: TButton object Button3: TButton
Left = 228 Left = 121
Top = 22 Top = 5
Width = 139 Width = 139
Height = 25 Height = 25
Caption = 'Get Customer By ID' Caption = 'Get Customer By ID'
TabOrder = 5 TabOrder = 1
OnClick = Button3Click OnClick = Button3Click
end end
object Button4: TButton object Button4: TButton
Left = 373 Left = 266
Top = 22 Top = 5
Width = 95 Width = 95
Height = 25 Height = 25
Caption = 'Add Estimate' Caption = 'Add Estimate'
TabOrder = 6 TabOrder = 2
OnClick = Button4Click OnClick = Button4Click
end end
object Button5: TButton object Button5: TButton
Left = 472 Left = 367
Top = 22 Top = 5
Width = 169 Width = 169
Height = 25 Height = 25
Caption = 'Show Customers with Orders' Caption = 'Show Customers with Orders'
TabOrder = 7 TabOrder = 3
OnClick = Button5Click OnClick = Button5Click
end end
object Memo1: TMemo
Left = 0
Top = 63
Width = 982
Height = 218
Align = alBottom
Lines.Strings = (
'')
ScrollBars = ssVertical
TabOrder = 4
end
object Button6: TButton
Left = 538
Top = 5
Width = 108
Height = 25
Caption = 'Match Customers'
TabOrder = 5
OnClick = Button6Click
end
object Button7: TButton
Left = 652
Top = 5
Width = 186
Height = 25
Caption = 'Show Customers without Orders'
TabOrder = 6
OnClick = Button7Click
end
object Button1: TButton
Left = 4
Top = 5
Width = 111
Height = 25
Caption = 'Get KG Customers'
TabOrder = 7
OnClick = Button1Click
end
object Panel1: TPanel
Left = 0
Top = 478
Width = 982
Height = 183
Align = alBottom
Caption = 'Panel1'
TabOrder = 8
OnResize = Panel1Resize
object asgData2: TAdvStringGrid
Left = 0
Top = 0
Width = 982
Height = 183
DrawingStyle = gdsClassic
FixedColor = clWhite
TabOrder = 0
GridLineColor = 13948116
GridFixedLineColor = 11250603
OnClickCell = asgData2ClickCell
ActiveCellFont.Charset = DEFAULT_CHARSET
ActiveCellFont.Color = 4474440
ActiveCellFont.Height = -12
ActiveCellFont.Name = 'Segoe UI'
ActiveCellFont.Style = [fsBold]
ActiveCellColor = 11565130
ActiveCellColorTo = 11565130
BorderColor = 11250603
ControlLook.FixedGradientFrom = clWhite
ControlLook.FixedGradientTo = clWhite
ControlLook.FixedGradientHoverFrom = clGray
ControlLook.FixedGradientHoverTo = clWhite
ControlLook.FixedGradientHoverMirrorFrom = clWhite
ControlLook.FixedGradientHoverMirrorTo = clWhite
ControlLook.FixedGradientHoverBorder = 11645361
ControlLook.FixedGradientDownFrom = clWhite
ControlLook.FixedGradientDownTo = clWhite
ControlLook.FixedGradientDownMirrorFrom = clWhite
ControlLook.FixedGradientDownMirrorTo = clWhite
ControlLook.FixedGradientDownBorder = 11250603
ControlLook.DropDownHeader.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownHeader.Font.Color = clWindowText
ControlLook.DropDownHeader.Font.Height = -11
ControlLook.DropDownHeader.Font.Name = 'Segoe UI'
ControlLook.DropDownHeader.Font.Style = []
ControlLook.DropDownHeader.Visible = True
ControlLook.DropDownHeader.Buttons = <>
ControlLook.DropDownFooter.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownFooter.Font.Color = clWindowText
ControlLook.DropDownFooter.Font.Height = -11
ControlLook.DropDownFooter.Font.Name = 'Segoe UI'
ControlLook.DropDownFooter.Font.Style = []
ControlLook.DropDownFooter.Visible = True
ControlLook.DropDownFooter.Buttons = <>
ControlLook.ToggleSwitch.BackgroundBorderWidth = 1.000000000000000000
ControlLook.ToggleSwitch.ButtonBorderWidth = 1.000000000000000000
ControlLook.ToggleSwitch.CaptionFont.Charset = DEFAULT_CHARSET
ControlLook.ToggleSwitch.CaptionFont.Color = clWindowText
ControlLook.ToggleSwitch.CaptionFont.Height = -12
ControlLook.ToggleSwitch.CaptionFont.Name = 'Segoe UI'
ControlLook.ToggleSwitch.CaptionFont.Style = []
ControlLook.ToggleSwitch.Shadow = False
Filter = <>
FilterDropDown.Font.Charset = DEFAULT_CHARSET
FilterDropDown.Font.Color = clWindowText
FilterDropDown.Font.Height = -12
FilterDropDown.Font.Name = 'Segoe UI'
FilterDropDown.Font.Style = []
FilterDropDown.TextChecked = 'Checked'
FilterDropDown.TextUnChecked = 'Unchecked'
FilterDropDownClear = '(All)'
FilterEdit.TypeNames.Strings = (
'Starts with'
'Ends with'
'Contains'
'Not contains'
'Equal'
'Not equal'
'Larger than'
'Smaller than'
'Clear')
FixedRowHeight = 22
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 3881787
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
FloatFormat = '%.2f'
HoverButtons.Buttons = <>
HTMLSettings.ImageFolder = 'images'
HTMLSettings.ImageBaseName = 'img'
Look = glCustom
PrintSettings.DateFormat = 'dd/mm/yyyy'
PrintSettings.Font.Charset = DEFAULT_CHARSET
PrintSettings.Font.Color = clWindowText
PrintSettings.Font.Height = -12
PrintSettings.Font.Name = 'Segoe UI'
PrintSettings.Font.Style = []
PrintSettings.FixedFont.Charset = DEFAULT_CHARSET
PrintSettings.FixedFont.Color = clWindowText
PrintSettings.FixedFont.Height = -12
PrintSettings.FixedFont.Name = 'Segoe UI'
PrintSettings.FixedFont.Style = []
PrintSettings.HeaderFont.Charset = DEFAULT_CHARSET
PrintSettings.HeaderFont.Color = clWindowText
PrintSettings.HeaderFont.Height = -12
PrintSettings.HeaderFont.Name = 'Segoe UI'
PrintSettings.HeaderFont.Style = []
PrintSettings.FooterFont.Charset = DEFAULT_CHARSET
PrintSettings.FooterFont.Color = clWindowText
PrintSettings.FooterFont.Height = -12
PrintSettings.FooterFont.Name = 'Segoe UI'
PrintSettings.FooterFont.Style = []
PrintSettings.PageNumSep = '/'
SearchFooter.ColorTo = clNone
SearchFooter.FindNextCaption = 'Find &next'
SearchFooter.FindPrevCaption = 'Find &previous'
SearchFooter.Font.Charset = DEFAULT_CHARSET
SearchFooter.Font.Color = clWindowText
SearchFooter.Font.Height = -12
SearchFooter.Font.Name = 'Segoe UI'
SearchFooter.Font.Style = []
SearchFooter.HighLightCaption = 'Highlight'
SearchFooter.HintClose = 'Close'
SearchFooter.HintFindNext = 'Find next occurrence'
SearchFooter.HintFindPrev = 'Find previous occurrence'
SearchFooter.HintHighlight = 'Highlight occurrences'
SearchFooter.MatchCaseCaption = 'Match case'
SearchFooter.ResultFormat = '(%d of %d)'
SelectionColor = 13744549
SortSettings.HeaderColor = clWhite
SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite
Version = '9.1.4.5'
ColWidths = (
64
64
64
64
64)
RowHeights = (
22
22
22
22
22
22
22
22
22
22)
end
end
object Panel2: TPanel
Left = 0
Top = 284
Width = 982
Height = 188
Align = alBottom
Caption = 'Panel2'
TabOrder = 9
OnResize = Panel2Resize
object asgData: TAdvStringGrid
Left = 1
Top = 1
Width = 980
Height = 186
Align = alBottom
DrawingStyle = gdsClassic
FixedColor = clWhite
TabOrder = 0
GridLineColor = 13948116
GridFixedLineColor = 11250603
OnClickCell = asgDataClickCell
ActiveCellFont.Charset = DEFAULT_CHARSET
ActiveCellFont.Color = 4474440
ActiveCellFont.Height = -12
ActiveCellFont.Name = 'Segoe UI'
ActiveCellFont.Style = [fsBold]
ActiveCellColor = 11565130
ActiveCellColorTo = 11565130
BorderColor = 11250603
ControlLook.FixedGradientFrom = clWhite
ControlLook.FixedGradientTo = clWhite
ControlLook.FixedGradientHoverFrom = clGray
ControlLook.FixedGradientHoverTo = clWhite
ControlLook.FixedGradientHoverMirrorFrom = clWhite
ControlLook.FixedGradientHoverMirrorTo = clWhite
ControlLook.FixedGradientHoverBorder = 11645361
ControlLook.FixedGradientDownFrom = clWhite
ControlLook.FixedGradientDownTo = clWhite
ControlLook.FixedGradientDownMirrorFrom = clWhite
ControlLook.FixedGradientDownMirrorTo = clWhite
ControlLook.FixedGradientDownBorder = 11250603
ControlLook.DropDownHeader.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownHeader.Font.Color = clWindowText
ControlLook.DropDownHeader.Font.Height = -11
ControlLook.DropDownHeader.Font.Name = 'Segoe UI'
ControlLook.DropDownHeader.Font.Style = []
ControlLook.DropDownHeader.Visible = True
ControlLook.DropDownHeader.Buttons = <>
ControlLook.DropDownFooter.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownFooter.Font.Color = clWindowText
ControlLook.DropDownFooter.Font.Height = -11
ControlLook.DropDownFooter.Font.Name = 'Segoe UI'
ControlLook.DropDownFooter.Font.Style = []
ControlLook.DropDownFooter.Visible = True
ControlLook.DropDownFooter.Buttons = <>
ControlLook.ToggleSwitch.BackgroundBorderWidth = 1.000000000000000000
ControlLook.ToggleSwitch.ButtonBorderWidth = 1.000000000000000000
ControlLook.ToggleSwitch.CaptionFont.Charset = DEFAULT_CHARSET
ControlLook.ToggleSwitch.CaptionFont.Color = clWindowText
ControlLook.ToggleSwitch.CaptionFont.Height = -12
ControlLook.ToggleSwitch.CaptionFont.Name = 'Segoe UI'
ControlLook.ToggleSwitch.CaptionFont.Style = []
ControlLook.ToggleSwitch.Shadow = False
Filter = <>
FilterDropDown.Font.Charset = DEFAULT_CHARSET
FilterDropDown.Font.Color = clWindowText
FilterDropDown.Font.Height = -12
FilterDropDown.Font.Name = 'Segoe UI'
FilterDropDown.Font.Style = []
FilterDropDown.TextChecked = 'Checked'
FilterDropDown.TextUnChecked = 'Unchecked'
FilterDropDownClear = '(All)'
FilterEdit.TypeNames.Strings = (
'Starts with'
'Ends with'
'Contains'
'Not contains'
'Equal'
'Not equal'
'Larger than'
'Smaller than'
'Clear')
FixedRowHeight = 22
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = 3881787
FixedFont.Height = -11
FixedFont.Name = 'Segoe UI'
FixedFont.Style = [fsBold]
FloatFormat = '%.2f'
HoverButtons.Buttons = <>
HTMLSettings.ImageFolder = 'images'
HTMLSettings.ImageBaseName = 'img'
Look = glCustom
PrintSettings.DateFormat = 'dd/mm/yyyy'
PrintSettings.Font.Charset = DEFAULT_CHARSET
PrintSettings.Font.Color = clWindowText
PrintSettings.Font.Height = -12
PrintSettings.Font.Name = 'Segoe UI'
PrintSettings.Font.Style = []
PrintSettings.FixedFont.Charset = DEFAULT_CHARSET
PrintSettings.FixedFont.Color = clWindowText
PrintSettings.FixedFont.Height = -12
PrintSettings.FixedFont.Name = 'Segoe UI'
PrintSettings.FixedFont.Style = []
PrintSettings.HeaderFont.Charset = DEFAULT_CHARSET
PrintSettings.HeaderFont.Color = clWindowText
PrintSettings.HeaderFont.Height = -12
PrintSettings.HeaderFont.Name = 'Segoe UI'
PrintSettings.HeaderFont.Style = []
PrintSettings.FooterFont.Charset = DEFAULT_CHARSET
PrintSettings.FooterFont.Color = clWindowText
PrintSettings.FooterFont.Height = -12
PrintSettings.FooterFont.Name = 'Segoe UI'
PrintSettings.FooterFont.Style = []
PrintSettings.PageNumSep = '/'
SearchFooter.ColorTo = clNone
SearchFooter.FindNextCaption = 'Find &next'
SearchFooter.FindPrevCaption = 'Find &previous'
SearchFooter.Font.Charset = DEFAULT_CHARSET
SearchFooter.Font.Color = clWindowText
SearchFooter.Font.Height = -12
SearchFooter.Font.Name = 'Segoe UI'
SearchFooter.Font.Style = []
SearchFooter.HighLightCaption = 'Highlight'
SearchFooter.HintClose = 'Close'
SearchFooter.HintFindNext = 'Find next occurrence'
SearchFooter.HintFindPrev = 'Find previous occurrence'
SearchFooter.HintHighlight = 'Highlight occurrences'
SearchFooter.MatchCaseCaption = 'Match case'
SearchFooter.ResultFormat = '(%d of %d)'
SelectionColor = 13744549
SortSettings.HeaderColor = clWhite
SortSettings.HeaderColorTo = clWhite
SortSettings.HeaderMirrorColor = clWhite
SortSettings.HeaderMirrorColorTo = clWhite
Version = '9.1.4.5'
ColWidths = (
64
64
64
64
64)
RowHeights = (
22
22
22
22
22
22
22
22
22
22)
end
end
object Button8: TButton
Left = 844
Top = 5
Width = 75
Height = 25
Caption = 'Get Items'
TabOrder = 10
OnClick = Button8Click
end
object Button9: TButton
Left = 121
Top = 32
Width = 95
Height = 25
Caption = 'Get Estimate'
TabOrder = 11
OnClick = Button9Click
end
object Button10: TButton
Left = 222
Top = 32
Width = 75
Height = 25
Caption = 'Update QB ID'
TabOrder = 12
OnClick = Button10Click
end
object Button11: TButton
Left = 316
Top = 32
Width = 113
Height = 25
Caption = 'update QB Items'
TabOrder = 13
OnClick = Button11Click
end
object Button12: TButton
Left = 435
Top = 32
Width = 190
Height = 25
Caption = 'Delete Customers without orders'
TabOrder = 14
OnClick = Button12Click
end
object uq: TUniQuery object uq: TUniQuery
Connection = ApiDatabase.ucKG Connection = ApiDatabase.ucKG
SQL.Strings = ( SQL.Strings = (
'select * from web_plate_orders') 'select * from web_plate_orders')
Left = 743 Left = 851
Top = 36 Top = 182
object uqORDER_ID: TIntegerField object uqORDER_ID: TIntegerField
FieldName = 'ORDER_ID' FieldName = 'ORDER_ID'
Required = True Required = True
......
unit qbAPI; unit qbAPI;
interface interface
...@@ -16,11 +16,7 @@ uses ...@@ -16,11 +16,7 @@ uses
type type
TfQB = class(TForm) TfQB = class(TForm)
Memo1: TMemo;
Button1: TButton;
Memo2: TMemo;
Button2: TButton; Button2: TButton;
asgData: TAdvStringGrid;
Button3: TButton; Button3: TButton;
Button4: TButton; Button4: TButton;
Button5: TButton; Button5: TButton;
...@@ -110,6 +106,21 @@ type ...@@ -110,6 +106,21 @@ type
uqupc_distortion_percent: TStringField; uqupc_distortion_percent: TStringField;
uqupc_distortion_amount: TStringField; uqupc_distortion_amount: TStringField;
uqstaff_fields_art_location: TStringField; uqstaff_fields_art_location: TStringField;
Memo1: TMemo;
Button6: TButton;
Button7: TButton;
Button1: TButton;
Panel1: TPanel;
asgData2: TAdvStringGrid;
Panel2: TPanel;
Splitter1: TSplitter;
asgData: TAdvStringGrid;
Splitter2: TSplitter;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
procedure Button1Click(Sender: TObject); procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject); procedure Button2Click(Sender: TObject);
...@@ -117,6 +128,17 @@ type ...@@ -117,6 +128,17 @@ type
procedure Button4Click(Sender: TObject); procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject); procedure Button5Click(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure asgData2ClickCell(Sender: TObject; ARow, ACol: Integer);
procedure asgDataClickCell(Sender: TObject; ARow, ACol: Integer);
procedure Panel1Resize(Sender: TObject);
procedure Panel2Resize(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
private private
{ Private declarations } { Private declarations }
strict private strict private
...@@ -126,14 +148,23 @@ type ...@@ -126,14 +148,23 @@ type
var var
AccessToken,RefreshToken,CompanyID,Client,Secret: string; AccessToken,RefreshToken,CompanyID,Client,Secret: string;
LastRefresh: TDateTime; LastRefresh: TDateTime;
ID, QB_ID: string;
public public
{ Public declarations } { Public declarations }
procedure findMatches(CustomerList: TJSONArray; JSONfield, DBField: string);
procedure getCompanyInfo(); procedure getCompanyInfo();
procedure LoadJsonArray(jaData: TJSONArray); procedure LoadJsonArray(jaData: TJSONArray);
procedure LoadJsonArray2(jaData: TJSONArray);
function RefreshAccessToken(): string; function RefreshAccessToken(): string;
procedure ConfigureSSL(IOHandler: TIdSSLIOHandlerSocketOpenSSL); procedure ConfigureSSL(IOHandler: TIdSSLIOHandlerSocketOpenSSL);
procedure SaveTokens(AccessToken, RefreshToken: string); procedure SaveTokens(AccessToken, RefreshToken: string);
procedure getCustomers(); procedure getCustomers();
procedure addEstimate(orderInfo: string);
procedure getQBCustomers();
procedure ShowDeleteConfirm(msg: string);
procedure ShowLinkConfirm(msg: string);
procedure DeleteCustomers();
procedure LinkCustomers();
end; end;
var var
...@@ -142,13 +173,290 @@ var ...@@ -142,13 +173,290 @@ var
implementation implementation
uses uses
Common.Logging, uLibrary; Common.Logging, uLibrary, Lookup.Service, Lookup.ServiceImpl;
{$R *.dfm} {$R *.dfm}
procedure TfQB.asgData2ClickCell(Sender: TObject; ARow, ACol: Integer);
var
point, origin: TPoint;
begin
origin := TPoint.Create(1,1);
point := asgData.find(origin, asgData2.Cells[2, ARow], []);
if point.Y = -1 then
point.Y := 0;
if point.X = -1 then
point.X := 0;
asgData.Row := point.Y;
asgData.Col := point.X;
if ( (point.X <> 0) and (point.Y <> 0) ) then
begin
QB_ID := asgData.Cells[1, asgData.Row];
ID := asgData2.Cells[1, asgData2.Row];
end
else
ID := asgData2.Cells[1, asgData2.Row];
end;
procedure TfQB.asgDataClickCell(Sender: TObject; ARow, ACol: Integer);
var
point, origin: TPoint;
begin
QB_ID := asgData.Cells[1, asgData.Row];
end;
procedure TfQB.Button10Click(Sender: TObject);
var
msg: string;
begin
if( ( QB_ID = '' ) or ( ID = '' ) ) then
begin
Memo1.Lines.Add('Please select a Quickbooks Customer and a KG Orders Customer');
Memo1.Lines.Add('Current QB ID: ' + QB_ID);
Memo1.Lines.Add('Current KG Orders ID: ' + ID);
end
else
begin
msg := 'Are you sure you want to link QB ID: ' + QB_ID + ' with KG Orders ID: ' + ID;
ShowLinkConfirm(msg);
end;
end;
procedure TfQB.LinkCustomers();
var
sql: string;
begin
sql := 'select QB_LIST_ID from customers where CUSTOMER_ID = ' + ID;
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Edit;
ordersDB.UniQuery1.FieldByName('QB_LIST_ID').AsString := QB_ID;
ordersDB.UniQuery1.Post;
getCustomers();
QB_ID := '';
ID := '';
end;
procedure TfQB.ShowLinkConfirm(msg: string);
begin
if MessageDlg(msg, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
// User confirmed
LinkCustomers();
end
else
begin
// User canceled
ShowMessage('Cancelled.');
end;
end;
procedure TfQB.Button11Click(Sender: TObject);
var
restClient: TRESTClient;
restRequest: TRESTRequest;
restResponse: TRESTResponse;
param: TRESTRequestParameter;
res: string;
jsValue: TJSONValue;
jsObj: TJSONObject;
ItemList: TJSONArray;
pair: TJSONPair;
ModifiedList: TJSONArray;
ParsedCustomer, Item: TJSONObject;
I: integer;
BillAddr: TJSONObject;
ShipAddr: TJSONObject;
sql: string;
begin
restClient := TRESTClient.Create(nil);
restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com';
restRequest := TRESTRequest.Create(nil);
restRequest.Client := restClient;
restResponse := TRESTResponse.Create(nil);
restRequest.Response := restResponse;
if MinutesBetween(Now, LastRefresh) > 58 then
begin
RefreshAccessToken();
end;
restRequest.Method := rmGET;
//res := '/v3/company/' + companyID + '/preferences';
res := '/v3/company/' + companyID + '/query?query=select * from Item&minorversion=75'; // '/customer/58';
restRequest.Resource := res;
param := restRequest.Params.AddItem;
param.Name := 'Authorization';
param.Kind := pkHTTPHEADER;
param.Options := param.Options + [TRESTRequestParameterOption.poDoNotEncode];
param.Value := 'Bearer ' + AccessToken;
restRequest.Execute;
//memo1.Lines.Add(restresponse.Content);
jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue);
//CustomerList := TJSONArray(restResponse.JSONValue);
Memo1.Lines.Add( jsObj.Format(2) );
ItemList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Item'));
for i := 0 to ItemList.Count - 1 do
begin
Item := ItemList.Items[i] as TJSONObject;
sql := 'select * from qb_items where qb_item_name = ' + quotedStr(Item.GetValue<string>('Name'));
doQuery(ordersDB.UniQuery1, sql);
if ( not ordersDB.UniQuery1.IsEmpty ) then
begin
ordersDB.UniQuery1.Edit;
ordersDB.uniquery1.FieldByName('qb_items_qb_id').AsString := Item.GetValue<string>('Id');
ordersDB.UniQuery1.Post;
end;
end;
// Load customer info
restClient.Free;
restRequest.Free;
restResponse.Free;
end;
procedure TfQB.Button12Click(Sender: TObject);
var
SQL: string;
cust_count, ship_count: string;
msg: string;
begin
SQL := 'select count(*) as cust_count from customers c ' +
' WHERE NOT EXISTS (SELECT 1 FROM corrugated_plate_orders cpo WHERE cpo.COMPANY_ID = c.CUSTOMER_ID) '+
'AND NOT EXISTS (SELECT 1 FROM web_plate_orders wpo WHERE wpo.COMPANY_ID = c.CUSTOMER_ID) ORDER BY c.SHORT_NAME';
DoQuery(ordersDB.UniQuery1, SQL);
cust_count := ordersDB.UniQuery1.FieldByName('cust_count').AsString;
SQL := 'select count(*) as ship_count from customers c join customers_ship cs on c.CUSTOMER_ID = cs.customer_id' +
' WHERE NOT EXISTS (SELECT 1 FROM corrugated_plate_orders cpo WHERE cpo.COMPANY_ID = c.CUSTOMER_ID) '+
'AND NOT EXISTS (SELECT 1 FROM web_plate_orders wpo WHERE wpo.COMPANY_ID = c.CUSTOMER_ID) ORDER BY c.SHORT_NAME';
DoQuery(ordersDB.UniQuery1, SQL);
ship_count := ordersDB.UniQuery1.FieldByName('ship_count').AsString;
msg := 'You will be deleting ' + cust_count + ' customers and their ' + ship_count + ' assoicated shipping addresses. Are you sure you want to continue?';
ShowDeleteConfirm(msg);
end;
procedure TfQB.DeleteCustomers();
var
SQL: string;
count: integer;
ModifiedList: TJSONArray;
Customer, ParsedCustomer: TJSONObject;
I: integer;
ship_count, cust_count: integer;
begin
Memo1.Lines.Add('Beginning to Delete Customers');
SQL := 'SELECT * FROM customers c ' +
'WHERE NOT EXISTS (SELECT 1 FROM corrugated_plate_orders cpo WHERE cpo.COMPANY_ID = c.CUSTOMER_ID) '+
'AND NOT EXISTS (SELECT 1 FROM web_plate_orders wpo WHERE wpo.COMPANY_ID = c.CUSTOMER_ID) ORDER BY c.SHORT_NAME';
doQuery(ordersDB.UniQuery1, SQL);
cust_count := 0;
ship_count := 0;
while( not ordersDB.UniQuery1.Eof ) do
begin
SQL := 'Select * from customers_ship where customer_id = ' + ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsString;
doQuery(ordersDB.UniQuery2, SQL);
ordersDB.UniQuery2.First;
while ( not ordersDB.UniQuery2.Eof) do
begin
ordersDB.UniQuery2.Delete;
ship_count := ship_count + 1;
end;
cust_count := cust_count + 1;
ordersDB.UniQuery1.Delete;
end;
Memo1.Lines.Add('Customers deleted: ' + inttostr(cust_count));
memo1.Lines.Add('Shipping Addresses deleted: '+ inttostr(ship_count));
end;
procedure TfQB.ShowDeleteConfirm(msg: string);
begin
if MessageDlg(msg, mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
// User confirmed
DeleteCustomers();
end
else
begin
// User canceled
ShowMessage('Cancelled.');
end;
end;
procedure TfQB.Button1Click(Sender: TObject); procedure TfQB.Button1Click(Sender: TObject);
begin begin
getCompanyInfo(); getCustomers();
end;
procedure TfQB.getCustomers();
var
SQL: string;
count: integer;
ModifiedList: TJSONArray;
Customer, ParsedCustomer: TJSONObject;
I: integer;
begin
SQL := 'SELECT * FROM customers c';
doQuery(ordersDB.UniQuery1, SQL);
ModifiedList := TJSONArray.Create;
while not ordersDB.UniQuery1.Eof do
begin
ParsedCustomer := TJSONObject.Create;
//sql := 'select CUSTOMER_ID from customers where QB_LIST_ID = ' + Customer.GetValue<string>('Id');
//doQuery(ordersDB.UniQuery1, SQL);
try
//ParsedCustomer.AddPair('In KGOrders', not(ordersDB.UniQuery1.IsEmpty));
ParsedCustomer.AddPair('Id', ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsString);
ParsedCustomer.AddPair('CompanyName', ordersDB.UniQuery1.FieldByName('NAME').AsString);
ParsedCustomer.AddPair('BillAddrCity', ordersDB.UniQuery1.FieldByName('BILL_CITY').AsString);
ParsedCustomer.AddPair('BillAddrLine1', ordersDB.UniQuery1.FieldByName('BILL_ADDRESS').AsString);
ParsedCustomer.AddPair('BillAddrState', ordersDB.UniQuery1.FieldByName('BILL_STATE').AsString);
ParsedCustomer.AddPair('BillAddrZip', ordersDB.UniQuery1.FieldByName('BILL_ZIP').AsString);
ParsedCustomer.AddPair('BillAddr', ordersDB.UniQuery1.FieldByName('BILL_ADDRESS_BLOCK').AsString);
ParsedCustomer.AddPair('QB_ID', TJSONString.Create(ordersDB.UniQuery1.FieldByName('QB_LIST_ID').AsString));
ModifiedList.AddElement(ParsedCustomer);
ordersDB.UniQuery1.Next;
except
ParsedCustomer.Free;
raise;
end;
end;
LoadJSONArray2(ModifiedList);
end; end;
procedure TfQB.SaveTokens(AccessToken, RefreshToken: string); procedure TfQB.SaveTokens(AccessToken, RefreshToken: string);
...@@ -174,10 +482,9 @@ begin ...@@ -174,10 +482,9 @@ begin
f.Free; f.Free;
end; end;
procedure TfQB.Button2Click(Sender: TObject); procedure TfQB.Button2Click(Sender: TObject);
begin begin
GetCustomers(); GetQBCustomers();
end; end;
procedure TfQB.Button3Click(Sender: TObject); procedure TfQB.Button3Click(Sender: TObject);
...@@ -226,7 +533,6 @@ begin ...@@ -226,7 +533,6 @@ begin
jsValue := restResponse.JSONValue; jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue); jsObj := TJSONObject(jsValue);
//Memo2.Lines.Add(res);
Memo1.Lines.Add( jsObj.Format(2) ); Memo1.Lines.Add( jsObj.Format(2) );
// CustomerList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Customer')) ; // CustomerList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Customer')) ;
...@@ -241,19 +547,172 @@ end; ...@@ -241,19 +547,172 @@ end;
procedure TfQB.Button4Click(Sender: TObject); procedure TfQB.Button4Click(Sender: TObject);
var var
orderJSON: TJSONObject;
begin
orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', '19814');
addEstimate(orderJSON.ToString);
end;
procedure tfQb.addEstimate(orderInfo: string);
var
restClient: TRESTClient; restClient: TRESTClient;
restRequest: TRESTRequest; restRequest: TRESTRequest;
restResponse: TRESTResponse; restResponse: TRESTResponse;
param: TRESTRequestParameter; param: TRESTRequestParameter;
res: string; res: string;
i: integer;
jsValue: TJSONValue; jsValue: TJSONValue;
Customer: TJSONValue; Customer: TJSONValue;
jsObj: TJSONObject; jsObj: TJSONObject;
CustomerList: TJSONArray; CustomerList: TJSONArray;
pair: TJSONPair; pair: TJSONPair;
estimateJSON: TJSONObject; estimateJSON: TJSONObject;
SQL: string;
estimate: TEstimate;
CustomerRef: TRef;
CustomerRefJSON: TJSONObject;
Lines: TArray<string>;
BillAddr: TAddress;
BillAddrJSON: TJSONObject;
CustomField:TJSONObject;
CustomFields: TJSONArray;
ShipAddr: TAddress;
ShipAddrJSON: TJSONObject;
Items: TArray<TLine>;
ItemRef: TRef;
SalesItemLineDetail: TSalesItemLineDetail;
LineArray: TJSONArray;
LineObj, DetailObj, ItemRefObj: TJSONObject;
TaxCodeRef: TJSONObject;
TxnTaxCodeRef: TJSONObject;
TxnTaxDetail: TJSONObject;
JSONData: TJSONObject;
ORDER_ID: string;
table: string;
ShipMethodRef: TJSONObject;
begin begin
///v3/company/<realmID>/estimate BillAddrJSON := TJSONObject.Create;
ShipAddrJSON := TJSONObject.Create;
EstimateJSON := TJSONObject.Create;
CustomerRefJSON := TJSONObject.Create;
CustomFields := TJSONArray.Create;
CustomField := TJSONObject.Create;
LineArray := TJSONArray.Create;
LineObj := TJSONObject.Create;
DetailObj := TJSONObject.Create;
ItemRefObj := TJSONObject.Create;
TaxCodeRef := TJSONObject.Create;
TxnTaxCodeRef := TJSONObject.Create;
TxnTaxDetail := TJSONObject.Create;
JSONData := TJSONObject.ParseJSONValue(orderInfo) as TJSONObject;
ORDER_ID := JSONData.GetValue<string>('ORDER_ID');
// add logic to figure out what type of order it is
SQL := 'select * from orders where ORDER_ID = ' + ORDER_ID;
doQuery(ordersDB.UniQuery1, SQL);
if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'corrugated_plate' then
begin
table := 'corrugated_plate_orders';
end
else if ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString = 'web_plate' then
begin
table := 'web_plate_orders';
end
else
table := 'cutting_die_orders';
SQL := 'select * from ' + table + ' cpo join customers c on cpo.COMPANY_ID = c.CUSTOMER_ID join customers_ship cs on cpo.staff_fields_ship_to = cs.ship_block JOIN qb_items ON cpo.staff_fields_quickbooks_item = qb_items.qb_item_name where ORDER_ID = ' + ORDER_ID;
doQuery(ordersDB.UniQuery1, SQL);
estimateJSON.AddPair('TxnDate', ordersDB.UniQuery1.FieldByName('staff_fields_order_date').AsString);
// Update the Quickbooks list ID in the database
// CustomerRef.value :=
CustomerRefJSON := TJSONObject.Create;
CustomerRefJSON.AddPair('value', ordersDB.UniQuery1.FieldByName('QB_LIST_ID').AsString);
//CustomerRef.value := '59'
;
estimateJSON.AddPair('CustomerRef', CustomerRefJSON);
Lines := ordersDB.UniQuery1.FieldByName('staff_fields_invoice_to').AsString.Split([sLineBreak]);
for i := 0 to Length(Lines) - 2 do
begin
case i of
0: BillAddrJSON.AddPair('Line1', Lines[0]);
1: BillAddrJSON.AddPair('Line2', Lines[1]);
2: BillAddrJSON.AddPair('Line3', Lines[2]);
3: BillAddrJSON.AddPair('Line4', Lines[3]);
4: BillAddrJSON.AddPair('Line5', Lines[4]);
end;
end;
BillAddrJSON.AddPair('City', ordersDB.UniQuery1.FieldByName('BILL_CITY').AsString);
BillAddrJSON.AddPair('CountrySubDivisionCode', ordersDB.UniQuery1.FieldByName('BILL_STATE').AsString);
BillAddrJSON.AddPair('PostalCode', ordersDB.UniQuery1.FieldByName('BILL_ZIP').AsString);
estimateJSON.AddPair('BillAddr', BillAddrJSON);
CustomField.AddPair('DefinitionId', '1');
CustomField.AddPair('Name', 'CUSTID');
CustomField.AddPair('Type', 'StringType');
CustomField.AddPair('StringValue', ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString);
CustomFields.AddElement(CustomField);
EstimateJSON.AddPair('CustomField', CustomFields);
Lines := ordersDB.UniQuery1.FieldByName('ship_block').AsString.Split([sLineBreak]);
for i := 0 to Length(Lines) - 2 do
begin
case i of
0: ShipAddrJSON.AddPair('Line1', Lines[0]);
1: ShipAddrJSON.AddPair('Line2', Lines[1]);
2: ShipAddrJSON.AddPair('Line3', Lines[2]);
3: ShipAddrJSON.AddPair('Line4', Lines[3]);
4: ShipAddrJSON.AddPair('Line5', Lines[4]);
end;
end;
ShipAddrJSON.AddPair('City', ordersDB.UniQuery1.FieldByName('city').AsString);
ShipAddrJSON.AddPair('CountrySubDivisionCode', ordersDB.UniQuery1.FieldByName('state').AsString);
ShipAddrJSON.AddPair('PostalCode', ordersDB.UniQuery1.FieldByName('zip').AsString);
estimateJSON.AddPair('ShipAddr', ShipAddrJSON);
// 🔹 Line object representing one line item
LineObj := TJSONObject.Create;
if ( table = 'corrugated_plate_orders') or (table = 'cutting_die_orders' ) then
begin
if ordersDB.UniQuery1.FieldByName('general_special_instructions').AsString <> '' then
LineObj.AddPair('Description', ordersDB.UniQuery1.FieldByName('item_desc').AsString + ' - ' + ordersDB.UniQuery1.FieldByName('general_special_instructions').AsString);
end;
memo1.Lines.Add(ordersDB.UniQuery1.FieldByName('staff_fields_price').AsString);
memo1.Lines.Add(ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsString);
LineObj.AddPair('Amount', TJSONNumber.Create(ordersDB.UniQuery1.FieldByName('staff_fields_price').AsFloat));
memo1.Lines.Add(ordersDB.UniQuery1.FieldByName('staff_fields_price').AsString);
LineObj.AddPair('DetailType', 'SalesItemLineDetail');
ItemRefObj.AddPair('value', ordersDB.UniQuery1.FieldByName('qb_items_qb_id').AsString);
DetailObj.AddPair('ItemRef', ItemRefObj);
DetailObj.AddPair('Qty', TJSONNumber.Create(ordersDB.UniQuery1.FieldByName('staff_fields_quantity').AsFloat));
DetailObj.AddPair('UnitPrice', TJSONNumber.Create(ordersDB.UniQuery1.FieldByName('staff_fields_price').AsFloat));
LineObj.AddPair('SalesItemLineDetail', DetailObj);
LineArray.AddElement(LineObj);
EstimateJSON.AddPair('Line', LineArray);
if ordersDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString <> '' then
begin
estimateJSON.AddPair('ShipDate', ordersDB.UniQuery1.FieldByName('staff_fields_ship_date').AsString)
end;
restClient := TRESTClient.Create(nil); restClient := TRESTClient.Create(nil);
restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com'; restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com';
...@@ -279,6 +738,10 @@ begin ...@@ -279,6 +738,10 @@ begin
param.Options := param.Options + [TRESTRequestParameterOption.poDoNotEncode]; param.Options := param.Options + [TRESTRequestParameterOption.poDoNotEncode];
param.Value := 'Bearer ' + AccessToken; param.Value := 'Bearer ' + AccessToken;
Memo1.Lines.Add( estimateJSON.Format(2) );
restRequest.AddBody(estimateJSON.ToJSON, TRESTContentType.ctAPPLICATION_JSON);
restRequest.Execute; restRequest.Execute;
//memo1.Lines.Add(restresponse.Content); //memo1.Lines.Add(restresponse.Content);
...@@ -286,7 +749,6 @@ begin ...@@ -286,7 +749,6 @@ begin
jsValue := restResponse.JSONValue; jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue); jsObj := TJSONObject(jsValue);
//Memo2.Lines.Add(res);
Memo1.Lines.Add( jsObj.Format(2) ); Memo1.Lines.Add( jsObj.Format(2) );
//CustomerList := TJSONArray(restResponse.JSONValue); //CustomerList := TJSONArray(restResponse.JSONValue);
...@@ -303,24 +765,48 @@ procedure TfQB.Button5Click(Sender: TObject); ...@@ -303,24 +765,48 @@ procedure TfQB.Button5Click(Sender: TObject);
var var
SQL: string; SQL: string;
count: integer; count: integer;
ModifiedList: TJSONArray;
Customer, ParsedCustomer: TJSONObject;
I: integer;
begin begin
SQL := 'SELECT c.CUSTOMER_ID, c.SHORT_NAME, c.NAME FROM customers c ' + SQL := 'SELECT * FROM customers c ' +
'WHERE EXISTS (SELECT 1 FROM corrugated_plate_orders cpo WHERE cpo.COMPANY_ID = c.CUSTOMER_ID) '+ 'WHERE EXISTS (SELECT 1 FROM corrugated_plate_orders cpo WHERE cpo.COMPANY_ID = c.CUSTOMER_ID) '+
'OR EXISTS (SELECT 1 FROM web_plate_orders wpo WHERE wpo.COMPANY_ID = c.CUSTOMER_ID) ORDER BY c.SHORT_NAME'; 'OR EXISTS (SELECT 1 FROM web_plate_orders wpo WHERE wpo.COMPANY_ID = c.CUSTOMER_ID) ORDER BY c.SHORT_NAME';
doQuery(ordersDB.UniQuery1, SQL); doQuery(ordersDB.UniQuery1, SQL);
ModifiedList := TJSONArray.Create;
while not ordersDB.UniQuery1.Eof do while not ordersDB.UniQuery1.Eof do
begin begin
Memo2.Lines.Add(ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsString + ', ' + ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString + ', ' + ordersDB.UniQuery1.FieldByName('NAME').AsString); ParsedCustomer := TJSONObject.Create;
OrdersDB.UniQuery1.Next;
count := count + 1; //sql := 'select CUSTOMER_ID from customers where QB_LIST_ID = ' + Customer.GetValue<string>('Id');
//doQuery(ordersDB.UniQuery1, SQL);
try
//ParsedCustomer.AddPair('In KGOrders', not(ordersDB.UniQuery1.IsEmpty));
ParsedCustomer.AddPair('Id', ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsString);
ParsedCustomer.AddPair('CompanyName', ordersDB.UniQuery1.FieldByName('NAME').AsString);
ParsedCustomer.AddPair('BillAddrCity', ordersDB.UniQuery1.FieldByName('BILL_CITY').AsString);
ParsedCustomer.AddPair('BillAddrLine1', ordersDB.UniQuery1.FieldByName('BILL_ADDRESS').AsString);
ParsedCustomer.AddPair('BillAddrState', ordersDB.UniQuery1.FieldByName('BILL_STATE').AsString);
ParsedCustomer.AddPair('BillAddrZip', ordersDB.UniQuery1.FieldByName('BILL_ZIP').AsString);
ParsedCustomer.AddPair('BillAddr', ordersDB.UniQuery1.FieldByName('BILL_ADDRESS_BLOCK').AsString);
ModifiedList.AddElement(ParsedCustomer);
ordersDB.UniQuery1.Next;
except
ParsedCustomer.Free;
raise;
end;
end; end;
Memo2.Lines.Add('Showing ' + IntToStr(count) + ' entries'); LoadJSONArray2(ModifiedList);
end; end;
procedure TfQB.getCustomers(); procedure TfQB.Button6Click(Sender: TObject);
var var
restClient: TRESTClient; restClient: TRESTClient;
restRequest: TRESTRequest; restRequest: TRESTRequest;
...@@ -336,6 +822,7 @@ var ...@@ -336,6 +822,7 @@ var
I: integer; I: integer;
BillAddr: TJSONObject; BillAddr: TJSONObject;
ShipAddr: TJSONObject; ShipAddr: TJSONObject;
SQL: string;
begin begin
restClient := TRESTClient.Create(nil); restClient := TRESTClient.Create(nil);
restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com'; restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com';
...@@ -372,17 +859,320 @@ begin ...@@ -372,17 +859,320 @@ begin
jsValue := restResponse.JSONValue; jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue); jsObj := TJSONObject(jsValue);
Memo2.Lines.Add(res);
Memo2.Lines.Add( jsObj.Format(2) );
//CustomerList := TJSONArray(restResponse.JSONValue); //CustomerList := TJSONArray(restResponse.JSONValue);
CustomerList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Customer')) ; CustomerList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Customer')) ;
LoadJSONArray( CustomerList ); //LoadJSONArray( CustomerList );
findMatches(CustomerList, 'DisplayName', 'Name');
//findMatches(CustomerList, 'BillAddrLine1', 'BILL_ADDRESS');
//findMatches(CustomerList, 'BillAddrCity', 'BILL_CITY');
//findMatches(CustomerList, 'BillAddrState', 'BILL_STATE');
//findMatches(CustomerList, 'BillAddrZip', 'BILL_ZIP');
end;
procedure TfQB.Button7Click(Sender: TObject);
var
SQL: string;
count: integer;
ModifiedList: TJSONArray;
Customer, ParsedCustomer: TJSONObject;
I: integer;
begin
SQL := 'SELECT * FROM customers c ' +
'WHERE NOT EXISTS (SELECT 1 FROM corrugated_plate_orders cpo WHERE cpo.COMPANY_ID = c.CUSTOMER_ID) '+
'AND NOT EXISTS (SELECT 1 FROM web_plate_orders wpo WHERE wpo.COMPANY_ID = c.CUSTOMER_ID) ORDER BY c.SHORT_NAME';
doQuery(ordersDB.UniQuery1, SQL);
ModifiedList := TJSONArray.Create;
while not ordersDB.UniQuery1.Eof do
begin
ParsedCustomer := TJSONObject.Create;
//sql := 'select CUSTOMER_ID from customers where QB_LIST_ID = ' + Customer.GetValue<string>('Id');
//doQuery(ordersDB.UniQuery1, SQL);
try
//ParsedCustomer.AddPair('In KGOrders', not(ordersDB.UniQuery1.IsEmpty));
ParsedCustomer.AddPair('Id', ordersDB.UniQuery1.FieldByName('CUSTOMER_ID').AsString);
ParsedCustomer.AddPair('CompanyName', ordersDB.UniQuery1.FieldByName('NAME').AsString);
ParsedCustomer.AddPair('BillAddrCity', ordersDB.UniQuery1.FieldByName('BILL_CITY').AsString);
ParsedCustomer.AddPair('BillAddrLine1', ordersDB.UniQuery1.FieldByName('BILL_ADDRESS').AsString);
ParsedCustomer.AddPair('BillAddrState', ordersDB.UniQuery1.FieldByName('BILL_STATE').AsString);
ParsedCustomer.AddPair('BillAddrZip', ordersDB.UniQuery1.FieldByName('BILL_ZIP').AsString);
ParsedCustomer.AddPair('BillAddr', ordersDB.UniQuery1.FieldByName('BILL_ADDRESS_BLOCK').AsString);
ModifiedList.AddElement(ParsedCustomer);
ordersDB.UniQuery1.Next;
except
ParsedCustomer.Free;
raise;
end;
end;
LoadJSONArray2(ModifiedList);
end;
procedure TfQB.Button8Click(Sender: TObject);
var
restClient: TRESTClient;
restRequest: TRESTRequest;
restResponse: TRESTResponse;
param: TRESTRequestParameter;
res: string;
jsValue: TJSONValue;
jsObj: TJSONObject;
CustomerList: TJSONArray;
pair: TJSONPair;
ModifiedList: TJSONArray;
ParsedCustomer, Customer: TJSONObject;
I: integer;
BillAddr: TJSONObject;
ShipAddr: TJSONObject;
begin
restClient := TRESTClient.Create(nil);
restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com';
restRequest := TRESTRequest.Create(nil);
restRequest.Client := restClient;
restResponse := TRESTResponse.Create(nil);
restRequest.Response := restResponse;
if MinutesBetween(Now, LastRefresh) > 58 then
begin
RefreshAccessToken();
end;
restRequest.Method := rmGET;
//res := '/v3/company/' + companyID + '/preferences';
res := '/v3/company/' + companyID + '/query?query=select * from Item&minorversion=75'; // '/customer/58';
restRequest.Resource := res;
param := restRequest.Params.AddItem;
param.Name := 'Authorization';
param.Kind := pkHTTPHEADER;
param.Options := param.Options + [TRESTRequestParameterOption.poDoNotEncode];
param.Value := 'Bearer ' + AccessToken;
restRequest.Execute;
//memo1.Lines.Add(restresponse.Content);
jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue);
//CustomerList := TJSONArray(restResponse.JSONValue);
Memo1.Lines.Add( jsObj.Format(2) );
CustomerList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Item'));
loadJSONArray(CustomerList);
// Load customer info
restClient.Free;
restRequest.Free;
restResponse.Free;
end;
procedure TfQB.Button9Click(Sender: TObject);
var
restClient: TRESTClient;
restRequest: TRESTRequest;
restResponse: TRESTResponse;
param: TRESTRequestParameter;
res: string;
jsValue: TJSONValue;
jsObj: TJSONObject;
CustomerList: TJSONArray;
pair: TJSONPair;
ModifiedList: TJSONArray;
ParsedCustomer, Customer: TJSONObject;
I: integer;
BillAddr: TJSONObject;
ShipAddr: TJSONObject;
begin
restClient := TRESTClient.Create(nil);
restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com';
restRequest := TRESTRequest.Create(nil);
restRequest.Client := restClient;
restResponse := TRESTResponse.Create(nil);
restRequest.Response := restResponse;
if MinutesBetween(Now, LastRefresh) > 58 then
begin
RefreshAccessToken();
end;
restRequest.Method := rmGET;
//GET /v3/company/9341454243251288/query?query=<selectStatement>&minorversion=75
res := '/v3/company/' + companyID + '/query?query=select * from estimate where DocNumber = ' + quotedStr('1002') + '&minorversion=75';
restRequest.Resource := res;
param := restRequest.Params.AddItem;
param.Name := 'Authorization';
param.Kind := pkHTTPHEADER;
param.Options := param.Options + [TRESTRequestParameterOption.poDoNotEncode];
param.Value := 'Bearer ' + AccessToken;
restRequest.Execute;
memo1.Lines.Add(restresponse.Content);
jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue);
Memo1.Lines.Add( jsObj.Format(2) );
restClient.Free; restClient.Free;
restRequest.Free; restRequest.Free;
restResponse.Free; restResponse.Free;
end;
procedure TfQB.getQBCustomers();
var
restClient: TRESTClient;
restRequest: TRESTRequest;
restResponse: TRESTResponse;
param: TRESTRequestParameter;
res: string;
jsValue: TJSONValue;
jsObj: TJSONObject;
CustomerList: TJSONArray;
pair: TJSONPair;
ModifiedList: TJSONArray;
ParsedCustomer, Customer: TJSONObject;
I: integer;
BillAddr: TJSONObject;
ShipAddr: TJSONObject;
begin
restClient := TRESTClient.Create(nil);
restClient.BaseURL := 'https://sandbox-quickbooks.api.intuit.com';
restRequest := TRESTRequest.Create(nil);
restRequest.Client := restClient;
restResponse := TRESTResponse.Create(nil);
restRequest.Response := restResponse;
if MinutesBetween(Now, LastRefresh) > 58 then
begin
RefreshAccessToken();
end;
restRequest.Method := rmGET;
//res := '/v3/company/' + companyID + '/preferences';
res := '/v3/company/' + companyID + '/query?query=select * from Customer&minorversion=75'; // '/customer/58';
restRequest.Resource := res;
///query?query=select * from Customer where CompanyName = ' + quotedStr('TYOGA CONTAINER') + '&minorversion=75';
param := restRequest.Params.AddItem;
param.Name := 'Authorization';
param.Kind := pkHTTPHEADER;
param.Options := param.Options + [TRESTRequestParameterOption.poDoNotEncode];
param.Value := 'Bearer ' + AccessToken;
restRequest.Execute;
//memo1.Lines.Add(restresponse.Content);
jsValue := restResponse.JSONValue;
jsObj := TJSONObject(jsValue);
//CustomerList := TJSONArray(restResponse.JSONValue);
Memo1.Lines.Add( jsObj.Format(2) );
CustomerList := TJSONArray( TJSONObject( jsObj.GetValue('QueryResponse') ).GetValue('Customer')) ;
// Load customer info
ModifiedList := TJSONArray.Create;
for I := 0 to CustomerList.Count - 1 do
begin
Customer := CustomerList.Items[I] as TJSONObject;
Memo1.Lines.Add( Customer.Format(2) );
ParsedCustomer := TJSONObject.Create;
//sql := 'select CUSTOMER_ID from customers where QB_LIST_ID = ' + Customer.GetValue<string>('Id');
//doQuery(ordersDB.UniQuery1, SQL);
try
//ParsedCustomer.AddPair('In KGOrders', not(ordersDB.UniQuery1.IsEmpty));
ParsedCustomer.AddPair('Id', Customer.GetValue<string>('Id'));
ParsedCustomer.AddPair('CompanyName', Customer.GetValue<string>('DisplayName'));
// Handle Bill Address
if Customer.GetValue('BillAddr') is TJSONObject then
begin
BillAddr := Customer.GetValue('BillAddr') as TJSONObject;
ParsedCustomer.AddPair('BillAddrLine1', TJSONString.Create(BillAddr.GetValue<string>('Line1', '')));
ParsedCustomer.AddPair('BillAddrCity', TJSONString.Create(BillAddr.GetValue<string>('City', '')));
ParsedCustomer.AddPair('BillAddrState', TJSONString.Create(BillAddr.GetValue<string>('CountrySubDivisionCode', '')));
ParsedCustomer.AddPair('BillAddrZip', TJSONString.Create(BillAddr.GetValue<string>('PostalCode', '')));
ParsedCustomer.AddPair('BillAddr',
TJSONString.Create(
Customer.GetValue<string>('DisplayName') + sLineBreak +
BillAddr.GetValue('Line1', '') + ',' + sLineBreak +
BillAddr.GetValue('City', '') + ', ' +
BillAddr.GetValue('CountrySubDivisionCode', '') + ' ' +
BillAddr.GetValue('PostalCode', '')
)
);
end;
// Handle Ship Address
if Customer.GetValue('ShipAddr') is TJSONObject then
begin
BillAddr := Customer.GetValue('ShipAddr') as TJSONObject;
ParsedCustomer.AddPair('ShipAddrLine1', TJSONString.Create(BillAddr.GetValue<string>('Line1', '')));
ParsedCustomer.AddPair('ShipAddrCity', TJSONString.Create(BillAddr.GetValue<string>('City', '')));
ParsedCustomer.AddPair('ShipAddrState', TJSONString.Create(BillAddr.GetValue<string>('CountrySubDivisionCode', '')));
ParsedCustomer.AddPair('ShipAddrZip', TJSONString.Create(BillAddr.GetValue<string>('PostalCode', '')));
ParsedCustomer.AddPair('ShipAddr',
TJSONString.Create(
Customer.GetValue<string>('DisplayName') + sLineBreak +
BillAddr.GetValue('Line1', '') + ',' + sLineBreak +
BillAddr.GetValue('City', '') + ', ' +
BillAddr.GetValue('CountrySubDivisionCode', '') + ' ' +
BillAddr.GetValue('PostalCode', '')
)
);
end;
ModifiedList.AddElement(ParsedCustomer);
except
ParsedCustomer.Free;
raise;
end;
end;
LoadJSONArray(ModifiedList);
restClient.Free;
restRequest.Free;
restResponse.Free;
end; end;
...@@ -415,6 +1205,10 @@ begin ...@@ -415,6 +1205,10 @@ begin
Secret := iniFile.ReadString('Quickbooks', 'ClientSecret', ''); Secret := iniFile.ReadString('Quickbooks', 'ClientSecret', '');
CompanyID := iniFile.ReadString('Quickbooks', 'CompanyID', ''); CompanyID := iniFile.ReadString('Quickbooks', 'CompanyID', '');
RefreshToken := iniFile.ReadString('Quickbooks', 'RefreshToken', ''); RefreshToken := iniFile.ReadString('Quickbooks', 'RefreshToken', '');
AccessToken := iniFile.ReadString('Quickbooks', 'AccessToken', '');
LastRefresh := StrToDateTime(iniFile.ReadString('Quickbooks', 'LastRefresh', ''));
QB_ID := '';
ID := '';
end; end;
procedure TfQB.FormDestroy(Sender: TObject); procedure TfQB.FormDestroy(Sender: TObject);
...@@ -475,7 +1269,6 @@ begin ...@@ -475,7 +1269,6 @@ begin
// 4. Create and send request // 4. Create and send request
RequestStream := TStringStream.Create(PostData, TEncoding.UTF8); RequestStream := TStringStream.Create(PostData, TEncoding.UTF8);
try try
// Execute POST // Execute POST
try try
response := IdHTTP.Post('https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer', RequestStream); response := IdHTTP.Post('https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer', RequestStream);
...@@ -488,7 +1281,7 @@ begin ...@@ -488,7 +1281,7 @@ begin
Memo1.Lines.Add('Tokens Successfully Saved'); Memo1.Lines.Add('Tokens Successfully Saved');
except except
on E: EIdHTTPProtocolException do on E: EIdHTTPProtocolException do
Memo2.Lines.Add('Error: ' + E.Message + #13#10 + 'Response: ' + E.ErrorMessage); Memo1.Lines.Add('Error: ' + E.Message + #13#10 + 'Response: ' + E.ErrorMessage);
end; end;
finally finally
RequestStream.Free; RequestStream.Free;
...@@ -576,5 +1369,74 @@ begin ...@@ -576,5 +1369,74 @@ begin
asgData.AutoSizeColumns(true); asgData.AutoSizeColumns(true);
end; end;
procedure TfQB.LoadJsonArray2(jaData: TJSONArray);
var
jso: TJSONObject;
i, j: integer;
row: integer;
begin
Memo1.Lines.Add( '---------------------------------------------------------------' );
Memo1.Lines.Add( 'LoadJsonArray into asgData2' );
asgData2.ClearAll;
asgData2.RowCount := 1;
asgData2.StartUpdate;
jso := TJSONObject(jaData.Items[0]);
asgData2.ColCount := jso.Count+1;
for i := 0 to jso.Count - 1 do
begin
asgData2.Cells[i+1, 0] := jso.Pairs[i].JsonString.Value;
Memo1.Lines.Add('Header Key: ' + jso.Pairs[i].JsonString.Value);
end;
for i := 0 to jaData.Count - 1 do
begin
jso := TJSONObject(jaData.Items[i]);
asgData2.RowCount := asgData2.RowCount + 1;
row := asgData2.RowCount - 1;
for j := 0 to jso.Count - 1 do
asgData2.Cells[j+1, row] := jso.Pairs[j].JsonValue.Value;
end;
asgData2.EndUpdate;
asgData2.AutoSizeColumns(true);
end;
procedure TfQB.Panel1Resize(Sender: TObject);
begin
AsgData2.Width := Panel1.ClientWidth;
AsgData2.Height := Panel1.ClientHeight;
end;
procedure TfQB.Panel2Resize(Sender: TObject);
begin
AsgData.Width := Panel2.ClientWidth;
AsgData.Height := Panel2.ClientHeight;
end;
procedure tfQB.findMatches(CustomerList: TJSONArray; JSONfield, DBField: string);
var
I: integer;
Customer: TJSONObject;
SQL: string;
begin
Memo1.Lines.Add('Matching ' + JSONfield + ' on ' + DBField);
for I := 0 to CustomerList.Count - 1 do
begin
Customer := CustomerList.Items[I] as TJSONObject;
SQL := 'select COUNT(*) as count from customers where NAME = ' + quotedStr(Customer.GetValue<string>(JSONfield));
doQuery(ordersDB.UniQuery1, SQL);
if ordersDB.UniQuery1.FieldByName('count').AsInteger = 1 then
begin
SQL := 'select * from customers where ' + DBField + ' = ' + quotedStr(Customer.GetValue<string>(JSONfield));
doQuery(ordersDB.UniQuery1, SQL);
Memo1.Lines.Add('Match at ' + ordersDB.UniQuery1.FieldByName('SHORT_NAME').AsString)
end
else if ordersDB.UniQuery1.FieldByName('count').AsInteger > 1 then
Memo1.Lines.Add(ordersDB.UniQuery1.FieldByName('count').AsString + ' Matches at ' + Customer.GetValue<string>(JSONfield) + ' in field ' + JSONfield);
end;
end;
end. end.
...@@ -212,7 +212,7 @@ begin ...@@ -212,7 +212,7 @@ begin
ForceDirectories(ReportDir); ForceDirectories(ReportDir);
Logger.Log(5, 'Reports directory created: ' + ReportDir); Logger.Log(5, 'Reports directory created: ' + ReportDir);
end; end;
reportURL := FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf'; reportURL := 'reports/' + FormatDateTime('yyyymmdd_hhnnss', Now) + '.pdf';
ReportFileName := reportDir + reportUrl; ReportFileName := reportDir + reportUrl;
......
...@@ -1168,10 +1168,6 @@ object rptOrderList: TrptOrderList ...@@ -1168,10 +1168,6 @@ object rptOrderList: TrptOrderList
Required = True Required = True
Size = 128 Size = 128
end end
object uqOrdersORDER_DATE: TDateTimeField
FieldName = 'ORDER_DATE'
Required = True
end
object uqOrdersORDER_TYPE: TStringField object uqOrdersORDER_TYPE: TStringField
FieldName = 'ORDER_TYPE' FieldName = 'ORDER_TYPE'
Required = True Required = True
...@@ -1272,6 +1268,9 @@ object rptOrderList: TrptOrderList ...@@ -1272,6 +1268,9 @@ object rptOrderList: TrptOrderList
FieldName = 'NEW_SHIP_DONE' FieldName = 'NEW_SHIP_DONE'
Calculated = True Calculated = True
end end
object uqOrdersORDER_DATE: TDateField
FieldName = 'ORDER_DATE'
end
end end
object frxDBOrders: TfrxDBDataset object frxDBOrders: TfrxDBDataset
UserName = 'frxDBOrders' UserName = 'frxDBOrders'
...@@ -1281,126 +1280,6 @@ object rptOrderList: TrptOrderList ...@@ -1281,126 +1280,6 @@ object rptOrderList: TrptOrderList
DataSetOptions = [] DataSetOptions = []
Left = 444 Left = 444
Top = 232 Top = 232
FieldDefs = <
item
FieldName = 'ORDER_ID'
end
item
FieldName = 'Loc'
FieldType = fftString
Size = 16
end
item
FieldName = 'COMPANY_NAME'
FieldType = fftString
Size = 90
end
item
FieldName = 'JOB_NAME'
FieldType = fftString
Size = 128
end
item
FieldName = 'ORDER_DATE'
FieldType = fftDateTime
end
item
FieldName = 'ORDER_TYPE'
FieldType = fftString
Size = 45
end
item
FieldName = 'PROOF_DUE'
FieldType = fftDateTime
end
item
FieldName = 'PROOF_DONE'
FieldType = fftDateTime
end
item
FieldName = 'ART_DUE'
FieldType = fftDateTime
end
item
FieldName = 'ART_DONE'
FieldType = fftDateTime
end
item
FieldName = 'PLATE_DUE'
FieldType = fftDateTime
end
item
FieldName = 'PLATE_DONE'
FieldType = fftDateTime
end
item
FieldName = 'MOUNT_DUE'
FieldType = fftDateTime
end
item
FieldName = 'MOUNT_DONE'
FieldType = fftDateTime
end
item
FieldName = 'SHIP_DUE'
FieldType = fftDateTime
end
item
FieldName = 'SHIP_DONE'
FieldType = fftDateTime
end
item
FieldName = 'PRICE'
end
item
FieldName = 'QB_REF_NUM'
FieldType = fftString
Size = 24
end
item
FieldName = 'COLORS'
FieldType = fftString
end
item
FieldName = 'po_number'
FieldType = fftString
Size = 16
end
item
FieldName = 'quickbooks_item'
FieldType = fftString
Size = 45
end
item
FieldName = 'NEW_ORDER_DATE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_PROOF_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_ART_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_PLATE_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_MOUNT_DONE'
FieldType = fftString
Size = 20
end
item
FieldName = 'NEW_SHIP_DONE'
FieldType = fftString
Size = 20
end>
end end
object uqColors: TUniQuery object uqColors: TUniQuery
Connection = ucKG Connection = ucKG
......
...@@ -18,7 +18,6 @@ type ...@@ -18,7 +18,6 @@ type
uqOrdersLoc: TStringField; uqOrdersLoc: TStringField;
uqOrdersCOMPANY_NAME: TStringField; uqOrdersCOMPANY_NAME: TStringField;
uqOrdersJOB_NAME: TStringField; uqOrdersJOB_NAME: TStringField;
uqOrdersORDER_DATE: TDateTimeField;
uqOrdersORDER_TYPE: TStringField; uqOrdersORDER_TYPE: TStringField;
uqOrdersPROOF_DUE: TDateField; uqOrdersPROOF_DUE: TDateField;
uqOrdersPROOF_DONE: TDateTimeField; uqOrdersPROOF_DONE: TDateTimeField;
...@@ -42,6 +41,7 @@ type ...@@ -42,6 +41,7 @@ type
uqOrdersNEW_PLATE_DONE: TStringField; uqOrdersNEW_PLATE_DONE: TStringField;
uqOrdersNEW_MOUNT_DONE: TStringField; uqOrdersNEW_MOUNT_DONE: TStringField;
uqOrdersNEW_SHIP_DONE: TStringField; uqOrdersNEW_SHIP_DONE: TStringField;
uqOrdersORDER_DATE: TDateField;
procedure DataModuleCreate(Sender: TObject); procedure DataModuleCreate(Sender: TObject);
procedure uqOrdersCalcFields(DataSet: TDataSet); procedure uqOrdersCalcFields(DataSet: TDataSet);
...@@ -125,6 +125,7 @@ var ...@@ -125,6 +125,7 @@ var
OrderID: LongWord; OrderID: LongWord;
jsonStr: string; jsonStr: string;
begin begin
OrderID := uqOrdersORDER_ID.AsInteger; OrderID := uqOrdersORDER_ID.AsInteger;
if uqOrdersORDER_TYPE.AsString = 'web_plate' then if uqOrdersORDER_TYPE.AsString = 'web_plate' then
begin begin
...@@ -147,22 +148,26 @@ begin ...@@ -147,22 +148,26 @@ begin
uqColors.Close; // Ensure it is closed uqColors.Close; // Ensure it is closed
end; end;
if uqOrdersORDER_DATE.AsString <> '' then //uqOrdersORD.AsDateTime := uqOrdersORDER_DATE.AsDateTime;
//logger.Log(3, uqOrders.FieldByName('ORDER_DATE').AsString);
if uqOrdersORDER_DATE.AsString <> '' then
uqOrdersNEW_ORDER_DATE.AsString := FormatDateTime('m/d/yyyy HH:nn', uqOrdersORDER_DATE.AsDateTime) uqOrdersNEW_ORDER_DATE.AsString := FormatDateTime('m/d/yyyy HH:nn', uqOrdersORDER_DATE.AsDateTime)
else else
uqOrdersNEW_ORDER_DATE.AsString := ''; uqOrdersNEW_ORDER_DATE.AsString := '';
if uqOrdersPROOF_DONE.AsString <> '' then if uqOrdersPROOF_DONE.AsString <> '' then
uqOrdersNEW_PROOF_DONE.AsString := FormatDateTime('m/d/yyyy HH:nn', uqOrdersPROOF_DONE.AsDateTime) uqOrdersNEW_PROOF_DONE.AsString := FormatDateTime('m/d/yyyy HH:nn', uqOrdersPROOF_DONE.AsDateTime)
else else
uqOrdersNEW_PROOF_DONE.AsString := ''; uqOrdersNEW_PROOF_DONE.AsString := '';
if uqOrdersART_DONE.AsString <> '' then if uqOrdersART_DONE.AsString <> '' then
uqOrdersNEW_ART_DONE.AsString := FormatDateTime('m/d/yyyy HH:nn', uqOrdersART_DONE.AsDateTime) uqOrdersNEW_ART_DONE.AsString := FormatDateTime('m/d/yyyy HH:nn', uqOrdersART_DONE.AsDateTime)
else else
uqOrdersNEW_ART_DONE.AsString := ''; uqOrdersNEW_ART_DONE.AsString := '';
if uqOrdersPLATE_DONE.AsString <> '' then if uqOrdersPLATE_DONE.AsString <> '' then
uqOrdersNEW_PLATE_DONE.AsString := FormatDateTime('m/d/yyyy HH:nn', uqOrdersPLATE_DONE.AsDateTime) uqOrdersNEW_PLATE_DONE.AsString := FormatDateTime('m/d/yyyy HH:nn', uqOrdersPLATE_DONE.AsDateTime)
else else
uqOrdersNEW_PLATE_DONE.AsString := ''; uqOrdersNEW_PLATE_DONE.AsString := '';
......
...@@ -116,8 +116,8 @@ ...@@ -116,8 +116,8 @@
<DCC_UnitSearchPath>C:\RADTOOLS\FastMM4;$(DCC_UnitSearchPath)</DCC_UnitSearchPath> <DCC_UnitSearchPath>C:\RADTOOLS\FastMM4;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_MajorVer>0</VerInfo_MajorVer> <VerInfo_MajorVer>0</VerInfo_MajorVer>
<VerInfo_MinorVer>9</VerInfo_MinorVer> <VerInfo_MinorVer>9</VerInfo_MinorVer>
<VerInfo_Release>4</VerInfo_Release> <VerInfo_Release>7</VerInfo_Release>
<VerInfo_Keys>CompanyName=EM Systems;FileDescription=$(MSBuildProjectName);FileVersion=0.9.4.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.4.0;Comments=</VerInfo_Keys> <VerInfo_Keys>CompanyName=EM Systems;FileDescription=$(MSBuildProjectName);FileVersion=0.9.7.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=0.9.7.0;Comments=</VerInfo_Keys>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''"> <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode> <AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
......
[Settings] [Settings]
MemoLogLevel=3 MemoLogLevel=3
FileLogLevel=5 FileLogLevel=5
webClientVersion=0.9.4 webClientVersion=0.9.7
LogFileNum=628 LogFileNum=821
[Database] [Database]
--Server=192.168.159.131 --Server=192.168.159.153
Server=192.168.102.130 Server=192.168.102.130
--Server=192.168.75.133 --Server=192.168.75.133
Database=kg_order_entry Database=kg_order_entry
...@@ -17,6 +17,6 @@ Password=emsys01 ...@@ -17,6 +17,6 @@ Password=emsys01
CompanyID=9341454272655710 CompanyID=9341454272655710
ClientID=ABgO14uvjh8XqLud7spQ8lkb98AUpcdA7HbyMJfCAtl65sQ5yy ClientID=ABgO14uvjh8XqLud7spQ8lkb98AUpcdA7HbyMJfCAtl65sQ5yy
ClientSecret=bQ06TRemHeAGFzVHRaTUvUoBU9jpU9itK6MOMgqN ClientSecret=bQ06TRemHeAGFzVHRaTUvUoBU9jpU9itK6MOMgqN
RefreshToken=RT1-113-H0-1757255538seyqgsf5e04vo9schkoa RefreshToken=RT1-10-H0-1760618473k44t73jittvqlr4wynn6
AccessToken=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..Cqnj0xScf85NYKa6g4lanA.LN1AIU3ZlnDDbIMt-J4vl8V_gvcTfynSjGKYsmbhbfBJovq5IfZU4dHt6cqDAwUfnfOm42l-OpbwN9hWrZvUGlVx8x_3MA-vdtxIOByp7neq5vL2t4XcR5svPKIkX-CqlTsTb2ylBARiXehgk3tVHBysbHcnp0Ka0Ic_Waj64wQMYvE3Z-D19gCu-Xn9WFQwDICn8HSgJmHL2huLvRX-OrcxH6uERzLcQqRLsgT7fx9j68UWDW-KL_KRnzE43ieXlxXCwiCDnaF39Ei5iPHstnh19lGMgo1Z1mlF6tVZ9-8Z1prZutpiX8rzaPzS7Wdqo8pKtYaUqQZP6AGa6ZCqWR2BlF3y-R_FtheERNpafRiXWIDW68jOOrgp8QXc1uKA0sxDMjiLE7Bd0t9QAsIzln-0WiWIXFSlLGLimMd2oxxLoR7fpQvgB851I50b4S3V-c891WA8bHfuzScmjVwp40JxofhviFXwAevLNzRYvGkvIyz4oS9d6U6K_ZWKDB3iYxEgJzkFFwnfuPybWX7iNHwnmvFfAXz61jdaL9KRJM-lCChGuaQuv8_df9z_az_sbUtXJw2I8ivEppmDEQVxv49ZwzJlb6bFbqtnhy6ILO7_ecx3G1d4Utg-BrtgvzsR.oFJV6VBShL1-cERGZEqqkw AccessToken=eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwieC5vcmciOiJIMCJ9..IwosInYT2Am8LdNGXuY-zQ._QdW6AZ0up2uAna580wQy7qAZPo3nkfHo0eeSpKllcJ_s69nh33Ld41MnTkxeAv1v1bxhvkDxEvkevfNGnggNHU3XSqIqb6tTKcAqR4zPf14JYgOkn82tw_q2VXWLgboMMpP6CfcBHeZPIbJcEOkmX5g4CY0NOum1-_beYmDHE2sxAxnKxcg3rhjBo33BTFjXSg1xknvkTO_GVbyAWdyZmQOpFRfdXAeUDnPAEZhYNVfACFkEDubdK7PyfcAs_7un_E0NZf270tMc2W0HTyk24wCSLbfeeH2Su-G2wi21JszcNsXSNt9ayGtHEXNcWG6A54k1M8U7o_mvpCXLPEXDtJkx8HnBvTz_ZXrFaztQf0_c8DLld5zW8FC1wn-SzHyoCbYbR2M6tBjVLiK80_FlAal_YjBI8fk9BX7nBab6LbCBIcunt7hRsLWCPiRI8_fwM_Nj8rlvxtIoClcyV7_VpIpxCVUgmxKmgf7zuWD3fYc3i8Bg-DpgGgWPVATXSlfNKhOWIDZfyy0YOlkreXPlNdQwCJ1Su3_3yzu_DioV76C5orqoeWk25NiopiAqJ7cBMj15EiuFx-w3jaqCv6ovzEc5r3by510TNu6msjUh2RQ-nxVqLjyLt6VIp3O00e_.2itJJ0rFwI-foW2v1hDSrw
LastRefresh=5/28/2025 10:46:30 AM LastRefresh=7/7/2025 1:49:30 PM
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