Commit d7f1e3db by Cam Hayes

Fixed many issues discusses with elias and dave. still couldnt replicate login bug

parent 149a9791
object FViewAddAddress: TFViewAddAddress
Width = 281
Height = 402
TabOrder = 0
object WebLabel1: TWebLabel
Left = 8
Top = 283
......@@ -119,6 +120,7 @@ object FViewAddAddress: TFViewAddAddress
Top = 8
Width = 198
Height = 22
TabStop = False
ChildOrder = 12
Enabled = False
HeightPercent = 100.000000000000000000
......@@ -132,6 +134,7 @@ object FViewAddAddress: TFViewAddAddress
Caption = 'Save'
ChildOrder = 13
HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnSaveClick
end
......@@ -143,6 +146,7 @@ object FViewAddAddress: TFViewAddAddress
Caption = 'Cancel'
ChildOrder = 13
HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
end
......
// Small Pop-Up page when adding orders if you want to quickly add an address
unit View.AddAddress;
unit View.Address.Add;
interface
......
// Add Customer page for KGOrders. Handles Adding and Editting Customers and
// Their shipping addresses.
unit AddCustomer;
unit View.Customer.Add;
interface
......@@ -127,7 +127,7 @@ implementation
{$R *.dfm}
uses View.Main, View.Customers, View.SelectCustomer, Utils;
uses View.Main, View.Customers, View.Customer.Select, Utils;
class function TFViewAddCustomer.CreateForm(AElementID, customerInfo, info: string): TWebForm;
......
unit View.SelectCustomer;
unit View.Customer.Select;
interface
......
......@@ -61,7 +61,7 @@ var
implementation
uses
XData.Model.Classes, View.Main, View.SelectCustomer, Utils;
XData.Model.Classes, View.Main, View.Customer.Select, Utils;
{$R *.dfm}
......
......@@ -78,7 +78,7 @@ implementation
uses
XData.Model.Classes,
ConnectionModule, Auth.Service, Utils, View.AddItem, View.Main;
ConnectionModule, Auth.Service, Utils, View.Item.Add, View.Main;
{$R *.dfm}
......
......@@ -33,7 +33,6 @@ type
procedure lblUsersClick(Sender: TObject);
procedure lblordersClick(Sender: TObject);
procedure lblCustomersClick(Sender: TObject);
procedure lblQuickbooksClick(Sender: TObject);
private
{ Private declarations }
FUserInfo: string;
......@@ -75,12 +74,12 @@ uses
View.Home,
View.Items,
View.Users,
View.EditUser,
View.User.Add,
View.Orders,
View.OrderEntryCorrugated,
View.OrderEntryCuttingDie,
View.OrderEntryWeb,
View.Customers, AddCustomer;
View.Customers, View.Customer.Add;
{$R *.dfm}
......@@ -147,24 +146,13 @@ begin
ShowToast('Please Save or Cancel your changes', 'danger');
end;
procedure TFViewMain.lblQuickbooksClick(Sender: TObject);
begin
if ( not ( change ) ) then
begin
//ShowForm(TFViewQuickbooks);
lblAppTitle.Caption := 'Koehler-Gibson QuickBooks';
setActive('QuickBooks');
end
else
ShowToast('Please Save or Cancel your changes', 'danger');
end;
procedure TFViewMain.lblUsersClick(Sender: TObject);
begin
if ( not ( change ) ) then
begin
ShowForm(TFViewUsers);
lblAppTitle.Caption := 'Koehler-Gibson Users';
setActive('Users');
end
else
ShowToast('Please Save or Cancel your changes', 'danger');
......@@ -233,6 +221,7 @@ procedure TFViewMain.wllblUserProfileClick(Sender: TObject);
begin
ShowCrudForm(TFViewUserProfile);
lblAppTitle.Caption := 'Koehler-Gibson User Profile';
setActive('User Profile');
end;
//needs to be changed
......
// Pop-Up menu that appears when Add Order button is clicked on orders page.
// Used to select customer before entering an order.
unit View.AddOrder;
unit View.Order.Add;
interface
......
......@@ -669,7 +669,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 480
Width = 113
Height = 22
TabStop = False
Caption = 'Art Approved As Is'
ChildOrder = 79
ElementID = 'cbartapprovedasis'
......@@ -677,6 +676,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000
Role = 'null'
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'proofing_art_approved_as_is'
DataSource = wdsOrder
......@@ -688,7 +688,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 430
Width = 113
Height = 22
TabStop = False
Caption = 'PDF File'
ChildOrder = 79
ElementID = 'cbpdffile'
......@@ -696,6 +695,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000
Role = 'null'
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf_file'
DataSource = wdsOrder
......@@ -707,7 +707,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 406
Width = 113
Height = 22
TabStop = False
Caption = 'Wide Format'
ChildOrder = 79
ElementID = 'cbwideformat'
......@@ -715,6 +714,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000
Role = 'null'
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'proofing_wide_format'
DataSource = wdsOrder
......@@ -726,7 +726,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 382
Width = 113
Height = 22
TabStop = False
Caption = 'Print Card'
ChildOrder = 79
ElementID = 'cbprintcard'
......@@ -734,6 +733,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000
Role = 'null'
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'proofing_print_card'
DataSource = wdsOrder
......@@ -745,7 +745,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 356
Width = 113
Height = 22
TabStop = False
Caption = 'Full Size Panel'
ChildOrder = 79
ElementID = 'cbfullsizepanel'
......@@ -753,6 +752,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
HeightPercent = 100.000000000000000000
Role = 'null'
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'proofing_full_size_panel'
DataSource = wdsOrder
......@@ -799,6 +799,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
Role = 'null'
TabStop = False
WidthPercent = 100.000000000000000000
ItemIndex = -1
DataField = 'staff_fields_ship_to'
......@@ -829,6 +830,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ElementPosition = epRelative
HeightPercent = 100.000000000000000000
Role = 'null'
TabStop = False
WidthPercent = 100.000000000000000000
OnChange = wdbcbQuickbooksItemChange
ItemIndex = -1
......@@ -1023,7 +1025,6 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Role = ''
ShowFocus = False
ShowSeconds = False
TabStop = False
Text = ''
DataField = 'proofing_approved_date'
DataSource = wdsOrder
......@@ -1082,6 +1083,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85
ElementID = 'cbplates'
HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_plates'
DataSource = wdsOrder
......@@ -1097,6 +1099,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85
ElementID = 'cbsampleCarton'
HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_sample_ca'
DataSource = wdsOrder
......@@ -1112,6 +1115,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85
ElementID = 'cbftp'
HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_ftp'
DataSource = wdsOrder
......@@ -1127,6 +1131,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85
ElementID = 'cbcolorcopy'
HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_color_copy'
DataSource = wdsOrder
......@@ -1142,6 +1147,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85
ElementID = 'edtemail'
HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_e_mail'
DataSource = wdsOrder
......@@ -1157,6 +1163,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85
ElementID = 'edtexistingcuttingdie'
HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_existing_'
DataSource = wdsOrder
......@@ -1172,6 +1179,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85
ElementID = 'edtrefartapdf'
HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_ref_art_a'
DataSource = wdsOrder
......@@ -1187,6 +1195,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
ChildOrder = 85
ElementID = 'edtrefartprintcard'
HeightPercent = 100.000000000000000000
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'supplied_by_customer_ref_art_p'
DataSource = wdsOrder
......@@ -1198,12 +1207,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 378
Width = 113
Height = 22
TabStop = False
Caption = 'Full Mount'
ChildOrder = 85
ElementID = 'cbfullmount'
HeightPercent = 100.000000000000000000
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'mounting_full_mount'
DataSource = wdsOrder
......@@ -1215,12 +1224,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 356
Width = 113
Height = 22
TabStop = False
Caption = 'Sticky Bak'
ChildOrder = 85
ElementID = 'cbstickybak'
HeightPercent = 100.000000000000000000
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'mounting_sticky_bak'
DataSource = wdsOrder
......@@ -1232,12 +1241,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 235
Width = 113
Height = 22
TabStop = False
Caption = 'Excalibur Die'
ChildOrder = 85
ElementID = 'cbexcaliburdie'
HeightPercent = 100.000000000000000000
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'layout_excalibur_die'
DataSource = wdsOrder
......@@ -1249,12 +1258,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 309
Width = 113
Height = 22
TabStop = False
Caption = 'Loose'
ChildOrder = 84
ElementID = 'cbloose'
HeightPercent = 100.000000000000000000
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
end
object cbStripMount: TWebCheckBox
......@@ -1262,12 +1271,12 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 402
Width = 113
Height = 22
TabStop = False
Caption = 'Strip Mount'
ChildOrder = 84
ElementID = 'cbstripmount'
HeightPercent = 100.000000000000000000
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
end
object edtQBItemDescription: TWebEdit
......@@ -1275,6 +1284,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 551
Width = 121
Height = 22
TabStop = False
ChildOrder = 31
ElementID = 'edtitemdescription'
Enabled = False
......@@ -1286,6 +1296,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 149
Width = 121
Height = 22
TabStop = False
AutoCompletion = acNope
AutoSize = True
ChildOrder = 79
......@@ -1301,6 +1312,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 149
Width = 113
Height = 22
TabStop = False
Caption = 'In Quickbooks?'
ChildOrder = 29
ElementID = 'wdbcbinqb'
......@@ -1317,6 +1329,7 @@ object FOrderEntryCorrugated: TFOrderEntryCorrugated
Top = 185
Width = 121
Height = 22
TabStop = False
ChildOrder = 30
ElementID = 'edtordernum'
Enabled = False
......
......@@ -167,40 +167,40 @@
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Color Copy:</label>
<input type="checkbox" id="cbcolorcopy">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Color Copy?</label>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Plates:</label>
<input type="checkbox" id="cbplates">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Plates?</label>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Sample Carton:</label>
<input type="checkbox" id="cbsampleCarton">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Sample Carton?</label>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Email:</label>
<input type="checkbox" id="edtemail"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Email?</label>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">FTP:</label>
<input type="checkbox" id="cbftp"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">FTP?</label>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Other:</label>
<input class="form-control input-sm" id="edtother" style="width: 150px"/>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Existing Cutting Die:</label>
<input type="checkbox" id="edtexistingcuttingdie"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Existing Cutting Die?</label>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art Print Card:</label>
<input type="checkbox" id="edtrefartprintcard"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art Print Card?</label>
</div>
<div class="col-auto">
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art A PDF:</label>
<input type="checkbox" id="edtrefartapdf"/>
<label class='pe-2' style="font-weight: 700; font-size: 15px;">Ref Art A PDF?</label>
</div>
</div>
<h4 class="custom-h4 mt-3">Layout</h4>
......@@ -235,8 +235,8 @@
<input id="edtcadfile" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Excalibur Die:</label>
<input type="checkbox" id="cbexcaliburdie">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Excalibur Die?</label>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">RSC Style:</label>
......@@ -247,21 +247,21 @@
<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">Loose:</label>
<input type="checkbox" id="cbloose">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Loose:</label>
<input id="edtloose" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Sticky Bak:</label>
<input type="checkbox" id="cbstickybak">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Sticky Bak?</label>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Mount:</label>
<input type="checkbox" id="cbfullmount">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Mount?</label>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Strip Mount:</label>
<input type="checkbox" id="cbstripmount">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Strip Mount:</label>
<input id="edtstripmount" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
......@@ -337,28 +337,28 @@
<input id="edtproofshipto" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Size Panel:</label>
<input type="checkbox" id="cbfullsizepanel">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Size Panel?</label>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Print Card:</label>
<input type="checkbox" id="cbprintcard">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Print Card?</label>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Wide Format:</label>
<input type="checkbox" id="cbwideformat">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Wide Format?</label>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF File:</label>
<input type="checkbox" id="cbpdffile">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF File?</label>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Other:</label>
<input id="edtproofother" class="form-control input-sm" style="width: 150px"/>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Art Approved As Is:</label>
<input type="checkbox" id="cbartapprovedasis">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Art Approved As Is:</label>
</div>
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Approved Date:</label>
......@@ -386,7 +386,7 @@
<div class="row pb-3">
<div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label">Special Instructions</label>
<textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea>
<textarea id="edtspecialinstructions" class="form-control mb-3" style=" width: 800px; height: 150px;"></textarea>
</div>
</div>
</div>
......@@ -259,7 +259,7 @@ implementation
{$R *.dfm}
uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils;
View.Home, View.Main, View.Order.Add, View.Address.Add, Utils;
class function TFOrderEntryCorrugated.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
begin
......@@ -354,8 +354,8 @@ procedure TFOrderEntryCorrugated.btnDeleteClick(Sender: TObject);
begin
ShowConfirmationModal(
'Are you sure you want to delete this order?',
'Delete',
'Cancel',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
......@@ -388,32 +388,34 @@ end;
procedure TFOrderEntryCorrugated.btnQBClick(Sender: TObject);
var
orderJSON: TJSONObject;
qbEnabled: boolean;
begin
if AuthService.TokenPayload.Properties['qb_enabled'] then
qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
if not qbEnabled then
begin
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin
if ( VerifyQBOrder() )then
begin
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
if wdbcbINQB.Checked = false then
begin
if ( VerifyQBOrder() )then
begin
if wdbcbINQB.Checked = false then
begin
Utils.ShowSpinner('spinner');
orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', xdwdsOrder.FieldByName('ORDER_ID').AsString);
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
addEstimate(orderJSON.ToString);
end
else
ShowToast('Failure:Cannot submit orders already in QuickBooks', 'failure');
end;
Utils.ShowSpinner('spinner');
orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', xdwdsOrder.FieldByName('ORDER_ID').AsString);
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
addEstimate(orderJSON.ToString);
end
else
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
end
ShowToast('Failure:Cannot submit orders already in QuickBooks', 'failure');
end;
end
else
ShowToast('QB interface not currently active', 'info');
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
end;
[async] procedure TFOrderEntryCorrugated.GenerateReportPDF;
......@@ -1143,7 +1145,7 @@ begin
input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtprice'));
if edtPrice.Text = '' then
if ( ( edtPrice.Text = '' ) or ( StrToFloat(edtPrice.Text) <= 0 ) )then
begin
input.classList.add('is-invalid');
......@@ -1153,7 +1155,7 @@ begin
input.classList.remove('is-invalid');
input := TJSHTMLInputElement(document.getElementById('edtquantity'));
if edtQuantity.Text = '' then
if ( ( edtQuantity.Text = '' ) or ( StrToFloat(edtQuantity.Text) <= 0 ) ) then
begin
input.classList.add('is-invalid');
......
......@@ -154,12 +154,12 @@
</div>
</div>
</div>
<h4 class="custom-h4 mt-3">General</h4>
<h4 class="custom-h4 mt-3 mt-3">General</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">Special Instructions</label>
<textarea id="edtspecialinstructions" class="form-control" style=" width: 500px; height: 150px;"></textarea>
<textarea id="edtspecialinstructions" class="form-control mb-3" style=" width: 800px; height: 150px;"></textarea>
</div>
</div>
</div>
......
......@@ -129,7 +129,7 @@ implementation
{$R *.dfm}
uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils;
View.Home, View.Main, View.Order.Add, View.Address.Add, Utils;
class function TFOrderEntryCuttingDie.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
......@@ -192,30 +192,34 @@ end;
procedure TFOrderEntryCuttingDie.btnQBClick(Sender: TObject);
var
orderJSON: TJSONObject;
qbEnabled: boolean;
begin
if AuthService.TokenPayload.Properties['qb_enabled'] then
qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
if not qbEnabled then
begin
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin
if ( VerifyQBOrder() )then
begin
if ( VerifyQBOrder() )then
if wdbcbINQB.Checked = false then
begin
if wdbcbINQB.Checked = false then
begin
Utils.ShowSpinner('spinner');
orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', xdwdsOrder.FieldByName('ORDER_ID').AsString);
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
addEstimate(orderJSON.ToString);
end
else
ShowToast('Failure:Cannot submit orders already in QuickBooks', 'failure');
end;
end
else
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
Utils.ShowSpinner('spinner');
orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', xdwdsOrder.FieldByName('ORDER_ID').AsString);
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
addEstimate(orderJSON.ToString);
end
else
ShowToast('Failure:Cannot submit orders already in QuickBooks', 'failure');
end;
end
else
ShowToast('QB interface not currently active', 'info');
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
end;
procedure TFOrderEntryCuttingDie.WebButton2Click(Sender: TObject);
......@@ -320,8 +324,8 @@ end;
begin
ShowConfirmationModal(
'Are you sure you want to delete this order?',
'Delete',
'Cancel',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
......
......@@ -414,13 +414,13 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 96
Width = 113
Height = 22
TabStop = False
Caption = 'PDF'
ChildOrder = 79
ElementID = 'cbpdf'
Enabled = False
HeightPercent = 100.000000000000000000
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'proofing_pdf'
DataSource = wdsOrder
......@@ -446,13 +446,13 @@ object FOrderEntryWeb: TFOrderEntryWeb
Top = 238
Width = 113
Height = 22
TabStop = False
Caption = 'Full Size Ink Jet For Layout Content Only'
ChildOrder = 79
ElementID = 'cbfullsizeinkjet'
Enabled = False
HeightPercent = 100.000000000000000000
ShowFocus = False
TabOrder = -1
WidthPercent = 100.000000000000000000
DataField = 'proofing_full_size_ink_jet_for'
DataSource = wdsOrder
......
......@@ -207,8 +207,8 @@
<hr class="custom-hr">
<div class="row">
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF:</label>
<input type="checkbox" id="cbpdf">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF?</label>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">PDF To:</label>
......@@ -227,8 +227,8 @@
<input class="form-control input-sm" id="dtppdfdate3" type="date">
</div>
<div class="col-auto">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Size Ink Jet For Layout Content Only:</label>
<input type="checkbox" id="cbfullsizeinkjet">
<label label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Full Size Ink Jet For Layout Content Only?</label>
</div>
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Ink Jet To:</label>
......@@ -450,7 +450,7 @@
<div class="row">
<div class="col-auto">
<label style="font-weight: 700; font-size: 15px;" class="form-label">Comments</label>
<textarea id="edtcomments" class="form-control" style=" width: 500px; height: 150px;"></textarea>
<textarea id="edtcomments" class="form-control mb-3" style=" width: 800px; height: 150px;"></textarea>
</div>
</div>
</div>
......
......@@ -265,7 +265,7 @@ implementation
{$R *.dfm}
uses
View.Home, View.Main, View.AddOrder, View.AddAddress, Utils;
View.Home, View.Main, View.Order.Add, View.Address.Add, Utils;
class function TFOrderEntryWeb.CreateForm(AElementID, orderInfo, customerInfo, modeParam, info: string): TWebForm;
......@@ -418,8 +418,8 @@ procedure TFOrderEntryWeb.btnDeleteClick(Sender: TObject);
begin
ShowConfirmationModal(
'Are you sure you want to delete this order?',
'Delete',
'Cancel',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
......@@ -453,30 +453,34 @@ end;
procedure TFOrderEntryWeb.btnQBClick(Sender: TObject);
var
orderJSON: TJSONObject;
qbEnabled: boolean;
begin
if AuthService.TokenPayload.Properties['qb_enabled'] then
qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
if not qbEnabled then
begin
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
if ( VerifyQBOrder() )then
begin
if ( VerifyQBOrder() )then
if wdbcbINQB.Checked = false then
begin
if wdbcbINQB.Checked = false then
begin
Utils.ShowSpinner('spinner');
orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', xdwdsOrder.FieldByName('ORDER_ID').AsString);
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
addEstimate(orderJSON.ToString);
end
else
ShowToast('Failure:Cannot submit orders already in QuickBooks', 'failure');
end;
end
else
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
Utils.ShowSpinner('spinner');
orderJSON := TJSONObject.Create;
orderJSON.AddPair('ORDER_ID', xdwdsOrder.FieldByName('ORDER_ID').AsString);
orderJSON.AddPair('USER_ID', JS.toString(AuthService.TokenPayload.Properties['user_id']));
addEstimate(orderJSON.ToString);
end
else
ShowToast('Failure:Cannot submit orders already in QuickBooks', 'failure');
end;
end
else
ShowToast('QB interface not currently active', 'info');
ShowToast('Failure:User not authorized to add to QuickBooks', 'failure');
end;
procedure TFOrderEntryWeb.AddEstimate(orderID: string);
......
......@@ -125,7 +125,7 @@ var
implementation
uses
XData.Model.Classes, View.Main, View.AddOrder, View.Search, View.SetStatus, Utils;
XData.Model.Classes, View.Main, View.Order.Add, View.Search, View.SetStatus, Utils;
{$R *.dfm}
......@@ -175,7 +175,7 @@ begin
ShowConfirmationModal(
'You are about to generate a PDF for over 100 orders. This may take some time. Continue?',
'Yes',
'Cancel',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
......@@ -285,6 +285,7 @@ procedure TFViewOrders.WebFormCreate(Sender: TObject);
var
today: TDateTime;
params: TStringList;
btn: TJSHTMLElement;
begin
Utils.ShowSpinner('spinner');
DMConnection.ApiConnection.Connected := True;
......@@ -331,6 +332,22 @@ begin
statusOrderID := params.Values['orderID'];
companyID := params.Values['companyID'];
jobName := params.Values['jobName'];
wlcbOrderBy.Value := OrderBy;
btn := document.getElementById('btnorderby') as TJSHTMLElement;
if direction = 'DESC' then
begin
btnOrderBy.Caption := 'Descending';
btn.innerHTML := 'Descending <i class="fa fa-arrow-down"></i>';
direction := 'DESC';
end
else
begin
btnOrderBy.Caption := 'Ascending';
btn.innerHTML := 'Ascending <i class="fa fa-arrow-up"></i>';
direction := 'ASC';
end;
// Status1
startDate1 := params.Values['startDate1'];
......@@ -350,7 +367,7 @@ begin
else
null2 := StrToBool(params.Values['null2']);
end;
FViewMain.search := GenerateSearchOptions();
GenerateSearchOptions();
getOrders(FViewMain.search);
end;
......@@ -443,7 +460,7 @@ begin
companyID := newform.DBID;
orderType := newform.wcbOrderType.Text;
FViewMain.search := generateSearchOptions();
generateSearchOptions();
//searchOptions := generateSearchOptions();
edtSearch.Text := FViewMain.search;
getOrders(FViewMain.search);
......@@ -893,6 +910,7 @@ begin
if orderID <> '' then
searchOptions := searchOptions + '&orderID=' + orderID;
edtSearch.text := searchOptions;
FViewMain.search := searchOptions;
Result := searchOptions;
end;
......
......@@ -93,6 +93,7 @@ object FViewEditUser: TFViewEditUser
Top = 62
Width = 121
Height = 22
TabStop = False
ChildOrder = 7
ElementID = 'edtemail'
HeightPercent = 100.000000000000000000
......@@ -103,6 +104,7 @@ object FViewEditUser: TFViewEditUser
Top = 34
Width = 121
Height = 22
TabStop = False
ChildOrder = 13
ElementID = 'edtpassword'
HeightPercent = 100.000000000000000000
......@@ -131,6 +133,7 @@ object FViewEditUser: TFViewEditUser
Top = 5
Width = 121
Height = 22
TabStop = False
ChildOrder = 14
ElementID = 'edtfullname'
HeightPercent = 100.000000000000000000
......@@ -141,6 +144,7 @@ object FViewEditUser: TFViewEditUser
Top = 6
Width = 121
Height = 22
TabStop = False
ChildOrder = 14
ElementID = 'edtusername'
HeightPercent = 100.000000000000000000
......@@ -179,6 +183,7 @@ object FViewEditUser: TFViewEditUser
Font.Style = [fsBold]
HeightPercent = 100.000000000000000000
ParentFont = False
TabOrder = -1
WidthPercent = 100.000000000000000000
end
object edtRights: TWebEdit
......@@ -186,6 +191,7 @@ object FViewEditUser: TFViewEditUser
Top = 93
Width = 121
Height = 22
TabStop = False
ChildOrder = 19
ElementID = 'edtrights'
HeightPercent = 100.000000000000000000
......@@ -198,6 +204,7 @@ object FViewEditUser: TFViewEditUser
Height = 23
ElementID = 'cbaccess'
HeightPercent = 100.000000000000000000
TabStop = False
WidthPercent = 100.000000000000000000
ItemIndex = -1
Items.Strings = (
......@@ -210,6 +217,7 @@ object FViewEditUser: TFViewEditUser
Top = 62
Width = 121
Height = 22
TabStop = False
ChildOrder = 7
ElementID = 'edtQB'
HeightPercent = 100.000000000000000000
......
// Form that functions as both a way to edit or add users to the database
// Author: Cameron Hayes
unit View.EditUser;
unit View.User.Add;
interface
......@@ -99,6 +99,7 @@ begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', [userInfo]));
responseString := TJSObject(xdcResponse.Result);
Info := string(responseString['value']);
FViewMain.ShowUserForm(Info);
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
......@@ -123,14 +124,16 @@ begin
'&newuser=' + edtUsername.Text +
'&rights=' + edtRights.Text +
'&QB=' + edtQB.Text;
console.log(editOptions);
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.EditUser',
[editOptions]));
responseString := TJSObject(xdcResponse.Result);
Info := string(responseString['value']);
try
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.EditUser',
[editOptions]));
responseString := TJSObject(xdcResponse.Result);
Info := string(responseString['value']);
FViewMain.ShowUserForm(Info);
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end;
end;
class function TFViewEditUser.CreateForm(AElementID, Mode, Username, Password, Name, Status, Email,
......@@ -193,6 +196,7 @@ var
FormEl: TJSHTMLFormElement;
AllValid: Boolean;
begin
console.log(mode);
FormEl := TJSHTMLFormElement(document.getElementById('userprofileform'));
// Clear previous invalid state
......@@ -227,12 +231,15 @@ begin
ShowConfirmationModal(
'Are you sure you want to save changes?',
'Save',
'Cancel',
'Yes',
'No',
procedure(confirmed: Boolean)
begin
if confirmed then
EditUser;
if mode = 'ADD' then
AddUser()
else
EditUser();
end
);
end;
......
......@@ -28,8 +28,8 @@ object FViewUserProfile: TFViewUserProfile
WidthPercent = 100.000000000000000000
end
object WebLabel3: TWebLabel
Left = 39
Top = 59
Left = 41
Top = 60
Width = 38
Height = 14
Caption = 'User ID:'
......@@ -45,8 +45,8 @@ object FViewUserProfile: TFViewUserProfile
WidthPercent = 100.000000000000000000
end
object WebLabel2: TWebLabel
Left = 13
Top = 131
Left = 8
Top = 143
Width = 71
Height = 14
Caption = 'Email Address:'
......@@ -62,8 +62,8 @@ object FViewUserProfile: TFViewUserProfile
WidthPercent = 100.000000000000000000
end
object WebLabel4: TWebLabel
Left = 29
Top = 83
Left = 27
Top = 84
Width = 52
Height = 14
Caption = 'Username:'
......@@ -79,8 +79,8 @@ object FViewUserProfile: TFViewUserProfile
WidthPercent = 100.000000000000000000
end
object WebLabel5: TWebLabel
Left = 29
Top = 107
Left = 30
Top = 117
Width = 49
Height = 14
Caption = 'Full Name:'
......@@ -95,160 +95,157 @@ object FViewUserProfile: TFViewUserProfile
ParentFont = False
WidthPercent = 100.000000000000000000
end
object lblResult: TWebLabel
Left = 85
Top = 246
Width = 3
Height = 14
ElementID = 'view.userprofile.form.lblresult'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
object WebLabel6: TWebLabel
Left = 15
Top = 171
Width = 64
Height = 13
Caption = 'Access Type:'
ElementID = 'view.userprofile.form.lblAccessType'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
ParentFont = False
WidthPercent = 100.000000000000000000
end
object edtUsername: TWebEdit
Left = 85
Top = 80
Width = 121
Height = 21
ElementID = 'view.userprofile.form.edtUsername'
ElementPosition = epRelative
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
object WebLabel7: TWebLabel
Left = 47
Top = 196
Width = 32
Height = 13
Caption = 'QB ID:'
ElementID = 'view.userprofile.form.lblQBID'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
ReadOnly = True
WidthPercent = 100.000000000000000000
end
object edtUserId: TWebEdit
Left = 85
Top = 56
object WebDBEdit1: TWebDBEdit
Left = 90
Top = 168
Width = 121
Height = 21
ElementID = 'view.userprofile.form.edtUserID'
ElementPosition = epRelative
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
Height = 22
ChildOrder = 13
ElementClassName = 'form-control'
ElementID = 'view.userprofile.form.edtAccessType'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
ReadOnly = True
TabOrder = 1
Text = 'WebDBEdit1'
WidthPercent = 100.000000000000000000
DataField = 'AType'
DataSource = wdsUser
end
object edtFullName: TWebEdit
Left = 85
Top = 104
object WebDBEdit2: TWebDBEdit
Left = 90
Top = 140
Width = 121
Height = 21
ChildOrder = 5
ElementID = 'view.userprofile.form.edtFullName'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
Height = 22
ChildOrder = 13
ElementClassName = 'form-control'
ElementID = 'view.userprofile.form.edtEmail'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
Text = 'WebDBEdit1'
WidthPercent = 100.000000000000000000
DataField = 'email_address'
DataSource = wdsUser
end
object chkAdminUser: TWebCheckBox
Left = 85
Top = 179
Width = 113
object WebDBEdit3: TWebDBEdit
Left = 90
Top = 114
Width = 121
Height = 22
Caption = 'chkAdminUser'
ChildOrder = 9
ElementID = 'view.userprofile.form.chkAdminUser'
ElementPosition = epRelative
Enabled = False
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
ChildOrder = 13
ElementClassName = 'form-control'
ElementID = 'view.userprofile.form.edtFullName'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
ParentFont = False
Role = 'null'
Text = 'WebDBEdit1'
WidthPercent = 100.000000000000000000
DataField = 'full_name'
DataSource = wdsUser
end
object edtEmail: TWebEdit
object WebDBEdit4: TWebDBEdit
Left = 85
Top = 126
Top = 81
Width = 121
Height = 21
ChildOrder = 7
ElementID = 'view.userprofile.form.edtEmail'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
Height = 22
ChildOrder = 13
ElementClassName = 'form-control'
ElementID = 'view.userprofile.form.edtUsername'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
HideSelection = False
ParentFont = False
Text = 'WebDBEdit1'
WidthPercent = 100.000000000000000000
DataField = 'username'
DataSource = wdsUser
end
object btnConfirm: TWebButton
object WebDBEdit5: TWebDBEdit
Left = 85
Top = 207
Width = 96
Height = 25
Caption = 'Confirm Changes'
ChildOrder = 12
ElementID = 'view.userprofile.form.btnconfirm'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
Top = 57
Width = 121
Height = 22
ChildOrder = 13
ElementClassName = 'form-control'
ElementID = 'view.userprofile.form.edtUserID'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
ParentFont = False
Role = 'button'
Text = 'WebDBEdit1'
WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick
end
object btnCancel: TWebButton
Left = 208
Top = 210
Width = 96
Height = 25
Caption = 'Cancel Changes'
ChildOrder = 14
ElementID = 'view.userprofile.form.btncancel'
ElementPosition = epRelative
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Arial'
Font.Style = []
DataField = 'userID'
DataSource = wdsUser
end
object WebDBEdit6: TWebDBEdit
Left = 90
Top = 196
Width = 121
Height = 22
ChildOrder = 13
ElementClassName = 'form-control'
ElementID = 'view.userprofile.form.edtQBID'
ElementFont = efCSS
HeightStyle = ssAuto
HeightPercent = 100.000000000000000000
ParentFont = False
Role = 'button'
Text = 'WebDBEdit1'
WidthPercent = 100.000000000000000000
OnClick = btnCancelClick
DataField = 'QBID'
DataSource = wdsUser
end
object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection
Left = 359
Top = 52
end
object xdwdsUser: TXDataWebDataSet
Left = 314
Top = 216
object xdwdsUseruserID: TStringField
FieldName = 'userID'
end
object xdwdsUserusername: TStringField
FieldName = 'username'
end
object xdwdsUseremail_address: TStringField
FieldName = 'email_address'
end
object xdwdsUserQBID: TStringField
FieldName = 'QBID'
end
object xdwdsUserAType: TStringField
FieldName = 'Atype'
end
object xdwdsUserfull_name: TStringField
FieldName = 'full_name'
end
end
object wdsUser: TWebDataSource
AutoEdit = False
DataSet = xdwdsUser
Left = 422
Top = 262
end
end
......@@ -18,9 +18,7 @@
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>
class="form-control">
</div>
<div class="mb-3">
......@@ -28,9 +26,7 @@
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>
class="form-control">
</div>
<div class="mb-3">
......@@ -39,36 +35,26 @@
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>
class="form-control">
</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 class="mb-3">
<label id="view.userprofile.form.lblAccessType"
for="view.userprofile.form.edtAccessType"
class="form-label">Email&nbsp;Address</label>
<input id="view.userprofile.form.edtAccessType"
type="email"
class="form-control">
</div>
<div class="d-flex gap-2 mb-4">
<button id="view.userprofile.form.btnconfirm"
class="btn btn-primary flex-grow-1"
type="button">
Confirm&nbsp;Changes
</button>
<button id="view.userprofile.form.btncancel"
class="btn btn-danger flex-grow-1"
type="button">
Cancel&nbsp;Changes
</button>
<div class="mb-3">
<label id="view.userprofile.form.lblQBID"
for="view.userprofile.form.edtQBID"
class="form-label">Email&nbsp;Address</label>
<input id="view.userprofile.form.edtQBID"
type="email"
class="form-control">
</div>
<label id="view.userprofile.form.lblresult" class="form-text"></label>
</form>
</div>
</div>
......
......@@ -7,29 +7,34 @@ uses
WEBLib.Forms, WEBLib.Dialogs, Vcl.Controls, Vcl.StdCtrls, WEBLib.StdCtrls,
XData.Web.Client, WEBLib.ExtCtrls, DB, XData.Web.JsonDataset,
XData.Web.Dataset, XData.Web.Connection, Vcl.Forms, ConnectionModule,
WEBLib.Toast;
WEBLib.Toast, WEBLib.DBCtrls;
type
TFViewUserProfile = class(TWebForm)
WebLabel1: TWebLabel;
WebLabel3: TWebLabel;
edtUsername: TWebEdit;
WebLabel2: TWebLabel;
edtUserId: TWebEdit;
edtFullName: TWebEdit;
WebLabel4: TWebLabel;
WebLabel5: TWebLabel;
chkAdminUser: TWebCheckBox;
edtEmail: TWebEdit;
btnConfirm: TWebButton;
lblResult: TWebLabel;
XDataWebClient1: TXDataWebClient;
btnCancel: TWebButton;
WebDBEdit1: TWebDBEdit;
WebDBEdit2: TWebDBEdit;
WebDBEdit3: TWebDBEdit;
WebDBEdit4: TWebDBEdit;
WebDBEdit5: TWebDBEdit;
WebDBEdit6: TWebDBEdit;
WebLabel6: TWebLabel;
WebLabel7: TWebLabel;
xdwdsUser: TXDataWebDataSet;
wdsUser: TWebDataSource;
xdwdsUseruserID: TStringField;
xdwdsUserusername: TStringField;
xdwdsUseremail_address: TStringField;
xdwdsUserQBID: TStringField;
xdwdsUserAType: TStringField;
xdwdsUserfull_name: TStringField;
procedure WebFormShow(Sender: TObject);
procedure btnConfirmClick(Sender: TObject);
[async] procedure EditUser();
[async] procedure GetUser();
procedure btnCancelClick(Sender: TObject);
end;
var
......@@ -46,77 +51,9 @@ uses
{$R *.dfm}
procedure TFViewUserProfile.btnConfirmClick(Sender: TObject);
var
FormEl: TJSHTMLFormElement;
begin
FormEl := TJSHTMLFormElement(document.querySelector('form'));
ShowConfirmationModal(
'Are you sure you want to save changes to your profile?',
'Save',
'Cancel',
procedure(confirmed: Boolean)
begin
if confirmed then
EditUser;
end
);
end;
[async] procedure TFViewUserProfile.EditUser;
var
xdcResponse: TXDataClientResponse;
responseString: TJSObject;
editOptions, resultMsg: string;
begin
try
editOptions := '&username=' + edtUsername.Text +
'&fullname=' + edtFullName.Text +
'&email=' + edtEmail.Text;
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.EditUser', [editOptions]));
responseString := TJSObject(xdcResponse.Result);
resultMsg := string(responseString['value']);
Utils.ShowToast(resultMsg);
if resultMsg.ToLower.StartsWith('success:') then
FViewMain.ViewOrders('');
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
on E: Exception do
Utils.ShowErrorModal('Unexpected error: ' + E.Message);
end;
end;
procedure TFViewUserProfile.btnCancelClick(Sender: TObject);
begin
ShowConfirmationModal(
'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;
procedure TFViewUserProfile.WebFormShow(Sender: TObject);
begin
GetUser();
//edtJwt.Text := TJSJSON.stringify(AuthService.TokenPayload);
// View.UserProfile.WebFormShow
chkAdminUser.Checked := SameText(string(AuthService.TokenPayload.Properties['user_admin']), 'true');
end;
......@@ -133,11 +70,9 @@ begin
userList := TJSObject(xdcResponse.Result);
data := TJSArray(userList['data']);
user := TJSObject(data[0]);
edtUsername.Text := string(user['username']);
edtFullName.Text := string(user['full_name']);
edtEmail.Text := string(user['email_address']);
edtUserId.Text := string(user['userID']);
chkAdminUser.Checked := boolean(user['admin']);
console.log(user);
xdwdsUser.SetJsonData(user);
xdwdsUser.Open;
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
......
......@@ -140,7 +140,7 @@ begin
Rights := cells[7];
QB := cells[8];
FViewMain.EditUser('Edit', Username.innerText, Password.innerText, FullName.innerText,
FViewMain.EditUser('EDIT', Username.innerText, Password.innerText, FullName.innerText,
Status.innerText, Email.innerText, Access.innerText,
Rights.innerText, QB.innerText);
......@@ -343,20 +343,9 @@ begin
XDataWebDataSet1QBID.AsString, XDataWebDataSet1rights.AsInteger);
XDataWebDataSet1.Next;
end;
TotalPages := (userListLength + PageSize - 1) div PageSize;
if (PageNumber * PageSize) < userListLength then
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(PageNumber * PageSize) +
' of ' + IntToStr(userListLength);
end
else
begin
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
lblEntries.Caption := 'Showing entries ' + IntToStr((PageNumber - 1) * PageSize + 1) +
' - ' + IntToStr(userListLength) +
' of ' + IntToStr(userListLength);
end;
GeneratePagination(TotalPages);
except
on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
......@@ -453,7 +442,7 @@ end;
procedure TFViewUsers.btnAddUserClick(Sender: TObject);
begin
//Info := '';
FViewMain.EditUser('Add', '', '', '', '', '', '', '', '');
FViewMain.EditUser('ADD', '', '', '', '', '', '', '', '');
end;
......
......@@ -16,20 +16,20 @@ uses
View.Main in 'View.Main.pas' {FViewMain: TWebForm} {*.html},
View.Home in 'View.Home.pas' {FViewHome: TWebForm} {*.html},
View.Users in 'View.Users.pas' {FViewUsers: TWebForm} {*.html},
View.EditUser in 'View.EditUser.pas' {FViewEditUser: TWebForm} {*.html},
View.User.Add in 'View.User.Add.pas' {FViewEditUser: TWebForm} {*.html},
View.Orders in 'View.Orders.pas' {FViewOrders: TWebForm} {*.html},
View.OrderEntryCorrugated in 'View.OrderEntryCorrugated.pas' {FOrderEntryCorrugated: TWebForm} {*.html},
View.AddOrder in 'View.AddOrder.pas' {FAddOrder: TWebForm} {*.html},
View.Order.Add in 'View.Order.Add.pas' {FAddOrder: TWebForm} {*.html},
View.Search in 'View.Search.pas' {FSearch: TWebForm} {*.html},
View.SetStatus in 'View.SetStatus.pas' {FSetStatus: TWebForm} {*.html},
View.OrderEntryCuttingDie in 'View.OrderEntryCuttingDie.pas' {FOrderEntryCuttingDie: TWebForm} {*.html},
View.OrderEntryWeb in 'View.OrderEntryWeb.pas' {FOrderEntryWeb: TWebForm} {*.html},
View.Customers in 'View.Customers.pas' {FViewCustomers: TWebForm} {*.html},
AddCustomer in 'AddCustomer.pas' {FViewAddCustomer: TWebForm} {*.html},
View.AddAddress in 'View.AddAddress.pas' {FViewAddAddress: TWebForm} {*.html},
View.SelectCustomer in 'View.SelectCustomer.pas' {FSelectCustomer: TWebForm} {*.html},
View.Customer.Add in 'View.Customer.Add.pas' {FViewAddCustomer: TWebForm} {*.html},
View.Address.Add in 'View.Address.Add.pas' {FViewAddAddress: TWebForm} {*.html},
View.Customer.Select in 'View.Customer.Select.pas' {FSelectCustomer: TWebForm} {*.html},
Utils in 'Utils.pas',
View.AddItem in 'View.AddItem.pas' {fViewAddItem: TWebForm} {*.html};
View.Item.Add in 'View.Item.Add.pas' {fViewAddItem: TWebForm} {*.html};
{$R *.res}
......
......@@ -159,7 +159,7 @@
<Form>FViewUsers</Form>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.EditUser.pas">
<DCCReference Include="View.User.Add.pas">
<Form>FViewEditUser</Form>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
......@@ -171,7 +171,7 @@
<Form>FOrderEntryCorrugated</Form>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.AddOrder.pas">
<DCCReference Include="View.Order.Add.pas">
<Form>FAddOrder</Form>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
......@@ -196,23 +196,23 @@
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="AddCustomer.pas">
<DCCReference Include="View.Customer.Add.pas">
<Form>FViewAddCustomer</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.AddAddress.pas">
<DCCReference Include="View.Address.Add.pas">
<Form>FViewAddAddress</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="View.SelectCustomer.pas">
<DCCReference Include="View.Customer.Select.pas">
<Form>FSelectCustomer</Form>
<FormType>dfm</FormType>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
<DCCReference Include="Utils.pas"/>
<DCCReference Include="View.AddItem.pas">
<DCCReference Include="View.Item.Add.pas">
<Form>fViewAddItem</Form>
<DesignClass>TWebForm</DesignClass>
</DCCReference>
......
......@@ -83,7 +83,6 @@ begin
try
webClientVersion := iniFile.ReadString('Settings', 'webClientVersion', '');
Result.AddPair('webClientVersion', webClientVersion);
qbEnabled := iniFile.ReadBool('Quickbooks', 'Enabled', false);
if webClientVersion = '' then
begin
......@@ -93,8 +92,8 @@ begin
if clientVersion <> webClientVersion then
begin
Result.AddPair('error',
'Your browser is running an old version of the app.' + sLineBreak +
'Please click below to reload.');
'Your browser is running version' + webClientVersion + ' when it should be running ' +
clientVersion + sLineBreak + 'Please click below to reload.');
end;
finally
iniFile.Free;
......@@ -121,18 +120,18 @@ begin
if userState = 0 then
begin
raise EXDataHttpUnauthorized.Create('Invalid username or password');
logger.Log(2, 'Login Error: Invalid username or password');
raise EXDataHttpUnauthorized.Create('Invalid username or password');
end
else if userState = 1 then
begin
raise EXDataHttpUnauthorized.Create('User does not exist!');
logger.Log(2, 'Login Error: User does not exist!');
raise EXDataHttpUnauthorized.Create('User does not exist!');
end
else if userState = 2 then
begin
raise EXDataHttpUnauthorized.Create('User not active!');
logger.Log(2, 'Login Error: User not active!');
raise EXDataHttpUnauthorized.Create('User not active!');
end;
......@@ -148,14 +147,13 @@ begin
JWT.Claims.JWTId := LowerCase(Copy(TUtils.GuidToVariant(TUtils.NewGuid), 2, 36));
JWT.Claims.IssuedAt := Now;
JWT.Claims.Expiration := IncHour(Now, 24);
JWT.Claims.SetClaimOfType<string>('user_name', userName);
JWT.Claims.SetClaimOfType<string>('user_fullname', userFullName);
JWT.Claims.SetClaimOfType<string>('user_id', userId);
JWT.Claims.SetClaimOfType<string>('user_perspective_id', userPerspectiveID);
JWT.Claims.SetClaimOfType<string>('user_status', userStatus);
JWT.Claims.SetClaimOfType<string>('user_email', userEmail);
JWT.Claims.SetClaimOfType<string>('user_qb_id', userQBID);
JWT.Claims.SetClaimOfType<string>('user_access_type', userAccessType);
JWT.Claims.SetClaimOfType<string>('user_name', authDB.uq.FieldByName('USER_NAME').AsString);
JWT.Claims.SetClaimOfType<string>('user_fullname', authDB.uq.FieldByName('NAME').AsString);
JWT.Claims.SetClaimOfType<string>('user_id', authDB.uq.FieldByName('USER_ID').AsString);
JWT.Claims.SetClaimOfType<string>('user_status', authDB.uq.FieldByName('STATUS').AsString);
JWT.Claims.SetClaimOfType<string>('user_email', authDB.uq.FieldByName('EMAIL').AsString);
JWT.Claims.SetClaimOfType<string>('user_qb_id', authDB.uq.FieldByName('QB_ID').AsString);
JWT.Claims.SetClaimOfType<string>('user_access_type', authDB.uq.FieldByName('ACCESS_TYPE').AsString);
JWT.Claims.SetClaimOfType<boolean>('qb_enabled', qbEnabled);
Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT);
......@@ -175,7 +173,7 @@ begin
DoQuery(authDB.uq, SQL);
if authDB.uq.IsEmpty then
begin
Result := 1; //user does not exist, replace this with 0 for more security
Result := 1; //user does not exist, replace this with 0 for more security
end
else if ( authDB.uq.FieldByName('STATUS').AsString <> 'ACTIVE' ) then
Result := 2 // user is not active
......@@ -185,20 +183,11 @@ begin
checkString := THashSHA2.GetHashString(name + password, THashSHA2.TSHA2Version.SHA512).ToUpper;
if authDB.uq.FieldByName('PASSWORD').AsString = checkString then
begin
userName := user;
userFullName:= authDB.uq.FieldByName('NAME').AsString;;
userId := authDB.uq.FieldByName('USER_ID').AsString;
userStatus := authDB.uq.FieldByName('STATUS').AsString;
userPerspectiveID := authDB.uq.FieldByName('PERSPECTIVE_ID').AsString;
userEmail := authDB.uq.FieldByName('EMAIL').AsString;
userQBID := authDB.uq.FieldByName('QB_ID').AsString;
userAccessType := authDB.uq.FieldByName('ACCESS_TYPE').AsString;
Logger.Log(1, Format('AuthDB.SetLoginAuditEntry: "%s"', [user]) );
Result := 3; // Succcess
end
else
Result := 0; // invalid password
Result := 0; // invalid user or password
end;
end;
......
......@@ -180,37 +180,37 @@ begin
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->CompanyID: Entry not found' )
else
Logger.Log( 1, '--Quickbooks->CompanyID: ' + 'Entry found' );
Logger.Log( 1, '--Quickbooks->CompanyID: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'ClientID', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->ClientID: Entry not found' )
else
Logger.Log( 1, '--Quickbooks->ClientID: ' + 'Entry found' );
Logger.Log( 1, '--Quickbooks->ClientID: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'ClientSecret', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->ClientSecret: Entry not found' )
else
Logger.Log( 1, '--Quickbooks->ClientSecret: ' + 'Entry found' );
Logger.Log( 1, '--Quickbooks->ClientSecret: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'RefreshToken', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->RefreshToken: Entry not found' )
else
Logger.Log( 1, '--Quickbooks->RefreshToken: ' + 'Entry found' );
Logger.Log( 1, '--Quickbooks->RefreshToken: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'AccessToken', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->AccessToken: Entry not found' )
else
Logger.Log( 1, '--Quickbooks->AccessToken: ' + 'Entry found' );
Logger.Log( 1, '--Quickbooks->AccessToken: Entry found' );
iniStr := IniFile.ReadString( 'Quickbooks', 'LastRefresh', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->LastRefresh: Entry not found' )
else
Logger.Log( 1, '--Quickbooks->LastRefresh: ' + iniStr );
Logger.Log( 1, '--Quickbooks->LastRefresh: Entry Found' );
Logger.Log( 1, '' );
finally
......
......@@ -2,20 +2,20 @@
MemoLogLevel=4
FileLogLevel=4
webClientVersion=0.9.11
LogFileNum=164
LogFileNum=171
[Database]
Server=192.168.116.132
--Server=192.168.116.132
--Server=192.168.102.129
--Server=192.168.75.133
--Server=192.168.159.10
Server=192.168.159.10
--Database=kg_order_entry
--Username=root
--Password=emsys01
--Password=emsys!012
[Quickbooks]
Enabled=0
--Enabled=1
CompanyID=9341454336461805
ClientID=ABYqlDx1EsacZYXvHIJ7RDB7zmnQdwABU3fwQLIZPmBgU0VW1P
ClientSecret=PM7OnvQWsgOqjWfDpZAnyRttDN9446Am6d85pDxr
......
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