Commit aadb8619 by cam

Cleaned Up order page UI and fixed bugs that editting introduced

parent 39e0e52b
<div class="row">
<div class="col-12">
<h1 class="page-header pt-3" id="view.edituser.title" style="font-size: 24px;">Users</h1>
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
......
<div class="row">
<div class="col-12">
<h1 class="page-header pt-3" id="view.items.title" style="font-size: 24px;">Items</h1>
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
......
......@@ -27,8 +27,8 @@ object FViewMain: TFViewMain
Caption = ' User Profile'
end
object wllblLogout: TWebLinkLabel
Left = 548
Top = 103
Left = 551
Top = 143
Width = 41
Height = 15
ElementID = 'dropdown.menu.logout'
......@@ -61,7 +61,7 @@ object FViewMain: TFViewMain
end
object lblItemsList: TWebLinkLabel
Left = 560
Top = 69
Top = 85
Width = 29
Height = 15
ElementID = 'dropdown.menu.itemlist'
......@@ -73,7 +73,7 @@ object FViewMain: TFViewMain
end
object lblUsers: TWebLinkLabel
Left = 561
Top = 86
Top = 108
Width = 28
Height = 15
ElementID = 'dropdown.menu.users'
......@@ -96,6 +96,32 @@ object FViewMain: TFViewMain
WidthPercent = 100.000000000000000000
OnClick = lblordersClick
end
object lblCustomers: TWebLabel
Left = 540
Top = 69
Width = 57
Height = 15
Caption = 'Customers'
ElementID = 'lblcustomers'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblCustomersClick
end
object lblQuickbooks: TWebLabel
Left = 546
Top = 125
Width = 63
Height = 15
Caption = 'QuickBooks'
ElementID = 'lblquickbooks'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = lblQuickbooksClick
end
object WebPanel1: TWebPanel
Left = 77
Top = 112
......
......@@ -2,6 +2,20 @@
<nav class="navbar navbar-expand navbar-light bg-light" style="margin-bottom: 0px;">
<div class="container-fluid">
<a id="view.main.apptitle" class="navbar-brand" href="index.html">Koehler-Gibson Orders</a>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-tags fa-fw"></i><span> Orders</span></a>
</li>
<li class="nav-item">
<a class="dropdown-item" id="lblcustomers" href="#"><i class="fa fa-tags fa-fw"></i><span> Customers</span></a>
</li>
<li class="nav-item">
<a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-cubes fa-fw"></i><span> Items</span></a>
</li>
<li class="nav-item">
<a class="dropdown-item" id="lblquickbooks" href="#"><i class="fa fa-tags fa-fw"></i><span> QuickBooks</span></a>
</li>
</ul>
<div class="collapse navbar-collapse show" id="navbarNavDropdown">
<ul class="navbar-nav ms-auto">
<li class="nav-item dropdown">
......@@ -16,12 +30,6 @@
<a class="dropdown-item" id="dropdown.menu.userprofile" href="#"><i class="fa fa-user fa-fw"></i><span> User Profile</span></a>
</li>
<li>
<a class="dropdown-item" id="lblorders" href="#"><i class="fa fa-tags fa-fw"></i><span> Orders</span></a>
</li>
<li>
<a class="dropdown-item" id="dropdown.menu.itemlist" href="#"><i class="fa fa-cubes fa-fw"></i><span> Items</span></a>
</li>
<li>
<a class="dropdown-item" id="dropdown.menu.users" href="#"><i class="fas fa-address-book fa-fw"></i><span> Users</span></abbr></a>
</li>
<li>
......
......@@ -22,6 +22,8 @@ type
lblItemsList: TWebLinkLabel;
lblUsers: TWebLinkLabel;
lblorders: TWebLabel;
lblCustomers: TWebLabel;
lblQuickbooks: TWebLabel;
procedure WebFormCreate(Sender: TObject);
procedure mnuLogoutClick(Sender: TObject);
procedure wllblUserProfileClick(Sender: TObject);
......@@ -30,6 +32,8 @@ type
procedure lblItemsListClick(Sender: TObject);
procedure lblUsersClick(Sender: TObject);
procedure lblordersClick(Sender: TObject);
procedure lblCustomersClick(Sender: TObject);
procedure lblQuickbooksClick(Sender: TObject);
private
{ Private declarations }
FUserInfo: string;
......@@ -40,6 +44,7 @@ type
procedure ShowCrudForm( AFormClass: TWebFormClass );
//procedure EditUser( AParam, BParam, CParam, DParam, EParam: string);
function GetUserInfo: string;
procedure setActive(page: string);
public
{ Public declarations }
class procedure Display(LogoutProc: TLogoutProc);
......@@ -82,30 +87,73 @@ begin
//Change this later
lblUsers.Visible := true;
ShowForm(TFViewHome);
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
setActive('Orders');
end;
procedure TFViewMain.lblCustomersClick(Sender: TObject);
begin
//ShowForm(TFViewCustomers);
lblAppTitle.Caption := 'Koehler-Gibson Customers';
setActive('Customers');
end;
procedure TFViewMain.lblHomeClick(Sender: TObject);
begin
ShowForm(TFViewHome);
lblAppTitle.Caption := 'Koehler-Gibson Home';
//setActive('Home');
end;
procedure TFViewMain.lblordersClick(Sender: TObject);
begin
ShowForm(TFViewOrders);
lblAppTitle.Caption := 'Koehler-Gibson Orders';
setActive('Orders');
end;
procedure TFViewMain.lblQuickbooksClick(Sender: TObject);
begin
//ShowForm(TFViewQuickbooks);
lblAppTitle.Caption := 'Koehler-Gibson QuickBooks';
setActive('QuickBooks');
end;
procedure TFViewMain.lblUsersClick(Sender: TObject);
begin
ShowForm(TFViewUsers);
lblAppTitle.Caption := 'Koehler-Gibson Users';
end;
procedure TFViewMain.lblItemsListClick(Sender: TObject);
begin
ShowForm(TFViewItems);
lblAppTitle.Caption := 'Koehler-Gibson Items';
setActive('Items');
end;
procedure TFViewMain.setActive(page: string);
var
links: TJSNodeList;
link: TJSHTMLElement;
i: integer;
begin
// Get all the links in the navbar
links := document.querySelectorAll('.navbar-nav .nav-item a');
for i := 0 to links.length - 1 do
begin
link := TJSHTMLElement(links[i]);
link.classList.remove('active');
console.log(link.innerHTML);
console.log(link.innerText);
if link.innerText.Contains(page) then
link.classList.add('active');
end;
end;
procedure TFViewMain.mnuLogoutClick(Sender: TObject);
......@@ -123,6 +171,7 @@ end;
procedure TFViewMain.wllblUserProfileClick(Sender: TObject);
begin
ShowCrudForm(TFViewUserProfile);
lblAppTitle.Caption := 'Koehler-Gibson User Profile';
end;
......@@ -183,6 +232,7 @@ end;
procedure TFViewMain.ViewOrderEntry(orderInfo, mode: string);
begin
lblAppTitle.Caption := 'Koehler-Gibson Order Entry';
if Assigned(FChildForm) then
FChildForm.Free;
FChildForm := TFOrderEntry.CreateForm(WebPanel1.ElementID, orderInfo, mode);
......
......@@ -808,171 +808,158 @@ object FOrderEntry: TFOrderEntry
DataField = 'proofing_full_size_panel'
DataSource = WebDataSource1
end
object cbStripMount: TWebDBCheckBox
Left = 496
Top = 407
Width = 113
object edtSpecialInstructions: TWebDBEdit
Left = 852
Top = 185
Width = 121
Height = 22
Caption = 'Strip Mount'
AutoSize = True
ChildOrder = 78
ElementID = 'edtspecialinstructions'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'general_special_instructions'
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
Left = 752
Top = 558
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 79
ElementID = 'cbstripmount'
ElementID = 'btnconfirm'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object cbFullMount: TWebDBCheckBox
Left = 496
Top = 386
object cbRefArtAPDF: TWebCheckBox
Left = 316
Top = 463
Width = 113
Height = 20
Caption = 'Full Mount'
ChildOrder = 79
ElementID = 'cbfullmount'
Height = 22
Caption = 'Ref Art A PDF?'
ChildOrder = 76
ElementID = 'edtrefartapdf'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'mounting_full_mount'
DataSource = WebDataSource1
end
object cbStickyBak: TWebDBCheckBox
Left = 496
Top = 362
object cbRefArtPrintCard: TWebCheckBox
Left = 316
Top = 435
Width = 113
Height = 22
Caption = 'Sticky Bak'
ChildOrder = 79
ElementID = 'cbstickybak'
Caption = 'Ref Art Print Card?'
ChildOrder = 76
ElementID = 'edtrefartprintcard'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'mounting_sticky_bak'
DataSource = WebDataSource1
end
object WebDBCheckBox9: TWebDBCheckBox
Left = 496
Top = 306
object cbExistingCuttingDie: TWebCheckBox
Left = 316
Top = 407
Width = 113
Height = 22
Caption = 'Loose'
ChildOrder = 79
ElementID = 'cbloose'
Caption = 'Existing Cutting Die?'
ChildOrder = 76
ElementID = 'edtexistingcuttingdie'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataSource = WebDataSource1
end
object cbExcaliburDie: TWebDBCheckBox
Left = 496
Top = 233
object cbFTP: TWebCheckBox
Left = 320
Top = 318
Width = 113
Height = 22
Caption = 'Excalibur Die'
ChildOrder = 79
ElementID = 'cbexcaliburdie'
Caption = 'FTP?'
ChildOrder = 76
ElementID = 'edtftp'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'layout_excalibur_die'
DataSource = WebDataSource1
end
object cbSampleCarton: TWebDBCheckBox
object cbSampleCarton: TWebCheckBox
Left = 316
Top = 286
Top = 283
Width = 113
Height = 22
Caption = 'Sample Carton'
ChildOrder = 79
ElementID = 'cbsimpleCarton'
ChildOrder = 76
ElementID = 'cbsampleCarton'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_sample_ca'
DataSource = WebDataSource1
end
object cbPlate: TWebDBCheckBox
object cbPlates: TWebCheckBox
Left = 316
Top = 255
Width = 113
Height = 22
Caption = 'Plates'
ChildOrder = 79
ChildOrder = 76
ElementID = 'cbplates'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_plates'
DataSource = WebDataSource1
end
object cbColorCopy: TWebDBCheckBox
object cbColorCopy: TWebCheckBox
Left = 316
Top = 230
Top = 227
Width = 113
Height = 22
Caption = 'Color Copy'
ChildOrder = 79
ChildOrder = 76
ElementID = 'cbcolorcopy'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_color_copy'
DataSource = WebDataSource1
end
object edtSpecialInstructions: TWebDBEdit
Left = 852
Top = 185
Width = 121
object cbStripMount: TWebCheckBox
Left = 496
Top = 406
Width = 113
Height = 22
AutoSize = True
ChildOrder = 78
ElementID = 'edtspecialinstructions'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
DataField = 'general_special_instructions'
DataSource = WebDataSource1
end
object btnConfirm: TWebButton
Left = 752
Top = 558
Width = 96
Height = 25
Caption = 'Confirm'
ChildOrder = 79
ElementID = 'btnconfirm'
Caption = 'Strip Mount'
ChildOrder = 76
ElementID = 'cbstripmount'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object cbRefArtAPDF: TWebCheckBox
Left = 316
Top = 463
object cbFullMount: TWebCheckBox
Left = 496
Top = 382
Width = 113
Height = 22
Caption = 'Ref Art A PDF?'
Caption = 'Full Mount'
ChildOrder = 76
ElementID = 'edtrefartapdf'
ElementID = 'cbfullmount'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbRefArtPrintCard: TWebCheckBox
Left = 316
Top = 435
object cbStickyBak: TWebCheckBox
Left = 496
Top = 358
Width = 113
Height = 22
Caption = 'Ref Art Print Card?'
Caption = 'Sticky Bak'
ChildOrder = 76
ElementID = 'edtrefartprintcard'
ElementID = 'cbstickybak'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbExistingCuttingDie: TWebCheckBox
Left = 316
Top = 407
object cbLoose: TWebCheckBox
Left = 496
Top = 309
Width = 113
Height = 22
Caption = 'Existing Cutting Die?'
Caption = 'Loose'
ChildOrder = 76
ElementID = 'edtexistingcuttingdie'
ElementID = 'cbloose'
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object cbFTP: TWebCheckBox
Left = 320
Top = 318
object cbExcaliburDie: TWebCheckBox
Left = 496
Top = 233
Width = 113
Height = 22
Caption = 'FTP?'
Caption = 'Excalibur Die'
ChildOrder = 76
ElementID = 'edtftp'
HeightPercent = 100.000000000000000000
......
<h1 class="page-header pt-3" id="view.users.title" style="font-size: 24px;">Order Entry</h1>
<div class="col-12 col-md-8">
<div class="row">
<div class=col-sm>
......@@ -100,8 +99,8 @@
<input type="checkbox" id="cbplates">
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Simple Carton:</label>
<input type="checkbox" id="cbsimpleCarton">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Sample Carton:</label>
<input type="checkbox" id="cbsampleCarton">
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Disk or CD:</label>
......
......@@ -75,14 +75,6 @@ type
cbWideFormat: TWebDBCheckBox;
cbPrintCard: TWebDBCheckBox;
cbFullSizePanel: TWebDBCheckBox;
cbStripMount: TWebDBCheckBox;
cbFullMount: TWebDBCheckBox;
cbStickyBak: TWebDBCheckBox;
WebDBCheckBox9: TWebDBCheckBox;
cbExcaliburDie: TWebDBCheckBox;
cbSampleCarton: TWebDBCheckBox;
cbPlate: TWebDBCheckBox;
cbColorCopy: TWebDBCheckBox;
XDataWebClient1: TXDataWebClient;
edtSpecialInstructions: TWebDBEdit;
tmrScrollTop: TWebTimer;
......@@ -182,6 +174,14 @@ type
cbRefArtPrintCard: TWebCheckBox;
cbExistingCuttingDie: TWebCheckBox;
cbFTP: TWebCheckBox;
cbSampleCarton: TWebCheckBox;
cbPlates: TWebCheckBox;
cbColorCopy: TWebCheckBox;
cbStripMount: TWebCheckBox;
cbFullMount: TWebCheckBox;
cbStickyBak: TWebCheckBox;
cbLoose: TWebCheckBox;
cbExcaliburDie: TWebCheckBox;
procedure WebFormCreate(Sender: TObject);
procedure HideNotification();
procedure ShowNotification(Notification: string);
......@@ -247,13 +247,18 @@ begin
colorListJSON := TJSONObject.Create;
colorListJSON.AddPair('items', colorList);
XDataWebDataSet1.Edit;
XDataWebDataSet1colors_colors.Value := colorListJSON.ToString;
//Convert all dates to strings because I was having less issues with that data type.
XDataWebDataSet1staff_fields_proof_date.Value := DateTimeToStr(dtpProofDate.Date);
XDataWebDataSet1staff_fields_ship_date.Value := DateTimeToStr(dtpShipDate.Date);
XDataWebDataSet1staff_fields_art_due.Value := DateTimeToStr(dtpArtDue.Date);
XDataWebDataSet1staff_fields_mount_due.Value := DateTimeToStr(dtpMountDue.Date);
XDataWebDataSet1staff_fields_plate_due.Value := DateTimeToStr(dtpPlateDue.Date);
XDataWebDataSet1ORDER_DATE.Value := dtpOrderDate.Date;
// Convert all check boxes to strings because the database stores them as strings
if cbFTP.Checked then
XDataWebDataSet1supplied_by_customer_ftp.AsString := 'T'
else
......@@ -270,8 +275,26 @@ begin
XDataWebDataSet1supplied_by_customer_ref_art_a.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_ref_art_a.AsString := '';
if cbColorCopy.Checked then
XDataWebDataSet1supplied_by_customer_color_copy.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_color_copy.AsString := '';
if cbPlates.Checked then
XDataWebDataSet1supplied_by_customer_plates.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_plates.AsString := '';
if cbSampleCarton.Checked then
XDataWebDataSet1supplied_by_customer_sample_ca.AsString := 'T'
else
XDataWebDataSet1supplied_by_customer_sample_ca.AsString := '';
if cbPDFFile.Checked then
XDataWebDataSet1proofing_pdf_file.AsString := 'T'
else
XDataWebDataSet1proofing_pdf_file.AsString := '';
XDataWebDataSet1.Post;
XDataWebDataSet1.First;
console.log(XDataWebDataSet1supplied_by_customer_sample_ca.AsString);
while not XDataWebDataSet1.Eof do
begin
for Field in XDataWebDataSet1.Fields do
......@@ -283,11 +306,21 @@ begin
else
orderJSON.AddPair(Field.FieldName, Field.AsString); // Add all other fields
end
else if Field is TBooleanField then
begin
if Field.AsBoolean then
orderJSON.AddPair(Field.FieldName, 'T')
else
orderJSON.AddPair(Field.FieldName, '');
end;
end;
XDataWebDataSet1.Next;
end;
orderJSON.AddPair('COMPANY_ID', '749');
orderJSON.AddPair('USER_ID', '1011');
orderJSON.AddPair('mode', mode);
if mode = 'EDIT' then
orderJSON.AddPair('ORDER_ID', orderID);
AddCorrugatedOrder(orderJSON);
FViewMain.ViewOrders('Success');
end;
......@@ -463,12 +496,26 @@ begin
cbRefArtPrintCard.Checked := true
else
cbRefArtPrintCard.Checked := false;
if XDataWebDataSet1supplied_by_customer_color_copy.AsString = 'T' then
cbColorCopy.Checked := true
else
cbColorCopy.checked := false;
if XDataWebDataSet1supplied_by_customer_plates.AsString = 'T' then
cbPlates.Checked := true
else
cbPlates.Checked := false;
if XDataWebDataSet1supplied_by_customer_sample_ca.AsString = 'T' then
cbSampleCarton.Checked := true
else
cbSampleCarton.Checked := false;
end;
procedure TFOrderEntry.WebFormShow(Sender: TObject);
begin
getOrder(orderID);
HideNotification();
end;
procedure TFOrderEntry.HideNotification;
......
......@@ -171,8 +171,8 @@ object FViewOrders: TFViewOrders
Text = ''
end
object pnlMessage: TWebPanel
Left = 266
Top = 61
Left = 220
Top = 429
Width = 121
Height = 33
ElementClassName = 'card'
......@@ -214,6 +214,34 @@ object FViewOrders: TFViewOrders
OnClick = btnCloseNotificationClick
end
end
object WebButton1: TWebButton
Left = 174
Top = 79
Width = 96
Height = 25
Caption = 'Set Status'
ChildOrder = 11
ElementClassName = 'btn btn-light'
ElementID = 'btnsetstatus'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object WebButton2: TWebButton
Left = 344
Top = 79
Width = 96
Height = 25
Caption = 'PDF'
ChildOrder = 12
ElementClassName = 'btn btn-light'
ElementID = 'btngeneratepdf'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 426
......
<div class="row">
<div class="col-12">
<h1 class="page-header pt-3" id="view.orders.title" style="font-size: 24px;">Orders</h1>
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
......@@ -43,17 +42,20 @@
</div>
<form class="form-inline">
<div class= "row">
<div class="col-sm-5">
<div class="col-sm-3">
<label class="py-2" style="font-weight: 700;">Show <select class="custom-select" id="wcbpagesize" style="font-size: 1.00rem;"></select> entries</label>
</div>
<div class="col-sm-5">
<div class="col-sm-2">
<button class= "ps-3" id="btnaddorder"></button>
</div>
<div class="col-sm-2">
<button class= "ps-3" id="btnfilters"></button>
<button class= "ps-3" id="btnsetstatus"></button>
</div>
<div class="col-sm-2">
<button class= "ps-3" id="btnaddorder"></button>
<button class= "ps-3" id="btngeneratepdf"></button>
</div>
<div class="col-sm-2">
<button class= "ps-3" id="btnfilters"></button>
</div>
</div>
</form>
......
......@@ -51,6 +51,8 @@ type
pnlMessage: TWebPanel;
lblMessage: TWebLabel;
btnCloseNotification: TWebButton;
WebButton1: TWebButton;
WebButton2: TWebButton;
procedure WebFormCreate(Sender: TObject);
procedure btnApplyClick(Sender: TObject);
procedure btnSearchClick(Sender: TObject);
......@@ -117,7 +119,10 @@ end;
procedure TFViewOrders.WebFormShow(Sender: TObject);
begin
console.log(info);
ShowNotification(info);
if info <> '' then
ShowNotification(info)
else
HideNotification();
end;
procedure TFViewOrders.getUser();
......@@ -719,6 +724,7 @@ end;
procedure TFViewOrders.HideNotification;
begin
pnlMessage.ElementHandle.hidden := True;
info := '';
end;
procedure TFViewOrders.ShowNotification(Notification: string);
......
<div class="row">
<div class="col-lg-12">
<h1 class="page-header" id="view.userprofile.title">User Profile</h1>
<div class="row">
<div class=col-sm>
<div id="view.login.message" class="alert alert-danger">
......
<div class="row">
<div class="col-12">
<h1 class="page-header pt-3" id="view.users.title" style="font-size: 24px;">Users</h1>
<div class="container mt-4 px-0">
<div class="row justify-content-center">
<div class="col-12 col-md-8">
......
......@@ -19,6 +19,71 @@
box-sizing: border-box; /* Ensure padding is included in the element's total width and height */
}
/* Ensure that the title does not affect the navbar layout */
#view.main.apptitle {
display: flex;
align-items: center;
justify-content: flex-start; /* Align title to the left */
width: auto; /* Ensure it doesn't stretch the container */
margin-right: 20px; /* Optional: add space between title and navbar items */
}
/* Fixed width for title area to prevent shifting */
#title {
white-space: nowrap; /* Prevent the title text from wrapping */
width: 200px; /* Fixed width for the title */
text-overflow: ellipsis; /* Truncate text with ellipsis if it overflows */
overflow: hidden;
font-weight: bold; /* Optional: make the title text bold */
}
/* Navbar items - keep them aligned and spaced out */
.navbar-nav .nav-item {
padding: 0 15px; /* Adjust spacing between navbar items */
}
/* Flexbox for the entire navbar */
.navbar-nav {
display: flex;
justify-content: flex-end; /* Align navbar items to the right */
width: 100%;
}
/* Additional mobile responsiveness (optional) */
@media (max-width: 1200px) {
.navbar-nav {
flex-direction: column; /* Stack items vertically on smaller screens */
align-items: flex-start; /* Align items to the left */
}
.navbar-nav-spaced .nav-item {
padding: 10px 0; /* Adjust vertical spacing between items */
}
}
/* Make sure active navbar item color gets applied */
.navbar-nav .nav-item a.active {
color: #fff !important; /* Set text color to white for active item */
background-color: #004F84 !important; /* Darker blue for active background */
font-weight: bold;
}
/* Default navbar item color */
.navbar-nav .nav-item a {
color: #000 !important; /* Default color for links */
transition: color 0.3s ease;
}
/* Navbar item hover state */
.navbar-nav .nav-item a:hover {
color: #fff !important; /* Set hover text color to white */
background-color: #286090 !important; /* Light blue on hover */
}
.nav-item {
padding: 0 20px; /* Adjust this value for desired spacing between labels */
}
.mr-2 {
margin-right: 0.5rem;
}
......
......@@ -34,6 +34,7 @@ type
function generateSubQuery(filterType, statusType, currStatus: string): string;
function AddCorrugatedOrder(orderInfo: string): TJSONObject;
function AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
function EditStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: string): string;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
end;
......@@ -650,6 +651,7 @@ var
DateFormat: TFormatSettings;
CurrDate: TDateTime;
ORDER_ID: integer;
mode: string;
begin
DateFormat := TFormatSettings.Create;
DateFormat.ShortDateFormat := 'yyyy-mm-dd';
......@@ -657,12 +659,21 @@ begin
JSONData := TJSONObject.ParseJSONValue(orderInfo) as TJSONObject;
if JSONData = nil then
raise Exception.Create('Invalid JSON format'); // If parsing fails, raise an exception
SQL := 'select * from corrugated_plate_orders where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL);
if( True ) then
mode := JSONData.GetValue<string>('mode');
if mode = 'ADD' then
SQL := 'select * from corrugated_plate_orders where ORDER_ID = 0 and ORDER_ID <> 0'
else
begin
ORDER_ID := JSONData.GetValue<integer>('ORDER_ID');
SQL := 'select * from corrugated_plate_orders where ORDER_ID = ' + IntToStr(ORDER_ID);
end;
doQuery(ordersDB.UniQuery1, SQL);
try
ordersDB.UniQuery1.Insert;
if mode = 'ADD' then
ordersDB.UniQuery1.Insert
else
ordersDB.UniQuery1.Edit;
for Pair in JSONData do
begin
Field := ordersDB.UniQuery1.FindField(Pair.JsonString.Value); // Checks if the field exists in the dataset
......@@ -676,16 +687,27 @@ begin
end;
end;
// Post the new record to the database
// Post the record to the database
ordersDB.UniQuery1.Post;
if mode = 'ADD' then
begin
SQL := 'select * from orders where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Insert;
end
else
begin
SQL := 'select * from orders where ORDER_ID = ' + IntToStr(ORDER_ID);
doQuery(ordersDB.UniQuery1, SQL);
end;
ordersDB.UniQuery1.FieldByName('COMPANY_ID').AsString := JSONData.GetValue<string>('COMPANY_ID');
ordersDB.UniQuery1.FieldByName('ORDER_TYPE').AsString := 'corrugated_plate';
if mode = 'ADD' then
ordersDB.UniQuery1.FieldByName('ORDER_DATE').AsDateTime := Now;
if JSONData.GetValue<string>('staff_fields_price') = '' then
ordersDB.UniQuery1.FieldByName('PRICE').AsString := '0'
else
......@@ -697,9 +719,12 @@ begin
ordersDB.UniQuery1.Post;
ordersDB.UniQuery1.Close;
if mode = 'ADD' then
begin
ordersDB.UniQuery1.SQL.Text := 'SELECT LAST_INSERT_ID() AS OrderID'; // Use database's method to get the last inserted ID
ordersDB.UniQuery1.Open;
ORDER_ID := ordersDB.UniQuery1.FieldByName('OrderID').AsInteger;
end;
if JSONData.GetValue<string>('staff_fields_proof_date') <> '' then
AddStatusSchedule('PROOF', JSONData, ORDER_ID);
......@@ -720,43 +745,58 @@ begin
Result := TJSONObject.Create.AddPair('error', E.Message);
end;
end;
end
else
Result := TJSONObject.Create.AddPair('error', 'Order Already Exists');
end;
function TLookupService.AddStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: integer): string;
var
SQL: string;
temp: string;
mode: string;
begin
mode := order.GetValue<string>('mode');
if mode = 'ADD' then
begin
SQL := 'select * from orders_status_schedule where ORDER_ID = 0 and ORDER_ID <> 0';
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Insert;
end
else
begin
SQL := 'select * from orders_status_schedule where ORDER_ID = ' + IntToStr(ORDER_ID);
doQuery(ordersDB.UniQuery1, SQL);
ordersDB.UniQuery1.Edit;
end;
ordersDB.UniQuery1.FieldByName('ORDER_ID').AsInteger := ORDER_ID;
ordersDB.UniQuery1.FieldByName('ORDER_STATUS').AsString := StatusType;
if( (StatusType = 'PROOF') or (StatusType = 'SHIP') ) then
begin
//temp := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsString := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
ordersDB.UniQuery1.FieldByName('ORIGINAL_STATUS_DATE').AsString := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_date');
end
else
begin
//temp := order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due');
ordersDB.UniQuery1.FieldByName('STATUS_DATE').AsDateTime := StrToDateTime(order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due'));
ordersDB.UniQuery1.FieldByName('ORIGINAL_STATUS_DATE').AsDateTime := StrToDateTime(order.GetValue<string>('staff_fields_'+ StatusType.ToLower +'_due'));
end;
ordersDB.UniQuery1.FieldByName('USER_ID').AsString := order.GetValue<string>('USER_ID');
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := 1;
if mode = 'ADD' then
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := 1
else
ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger := ordersDB.UniQuery1.FieldByName('ORDER_REVISION').AsInteger + 1;
ordersDB.UniQuery1.Post;
Result := 'success';
end;
function TLookupService.EditStatusSchedule(StatusType: string; order: TJSONObject; ORDER_ID: string): string;
var
SQL: string;
begin
end;
function TLookupService.AddUser(userInfo:string): string;
var
user: string;
......
[Options]
LogFileNum=198
LogFileNum=207
UpdateTimerLength=0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment