Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dn/navarch 11 #8

Open
wants to merge 305 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
305 commits
Select commit Hold shift + click to select a range
0d7ef53
fixed wrong use of parcel api response, added Status values
jsx101 Jan 22, 2024
bea5885
24-01-24 01 cashflow qp plus n days; invoice gen remove qp+n days opt…
jsx101 Jan 24, 2024
23a0929
24-01-24 02 more logs for cashflow debugging
jsx101 Jan 24, 2024
60dac55
24-01-24 03 more logs for cashflow
jsx101 Jan 24, 2024
ee33baf
240124-04 fixed wrong code
jsx101 Jan 24, 2024
848a0e1
240124-05 fix error messages for cashflow
jsx101 Jan 24, 2024
e15de74
250124-01 fix wrong field name for est arrival date, update log
jsx101 Jan 25, 2024
1766598
250124-02 add cashflow configs to api call
jsx101 Jan 25, 2024
645643c
250124-03 better logs
jsx101 Jan 25, 2024
1580510
250124-04 fix payment info api call filter
jsx101 Jan 25, 2024
e80a226
250124-05 fix missing id field in contract fetch
jsx101 Jan 25, 2024
90806c5
250124-06 fix wrong fetch for parcel data
jsx101 Jan 25, 2024
875b36c
260124-01 remove older debug logs and added new ones, throw error in …
jsx101 Jan 26, 2024
b20d7ce
260124-02 logs with context for debugging, NonFatalError
jsx101 Jan 26, 2024
178874e
260124-03 fix wrong fetch of invoice number
jsx101 Jan 26, 2024
7d8872b
260124-04 wrong counterparty data fetch fix
jsx101 Jan 26, 2024
6002e95
260124-05 fixed Add Assay and Add Weight buttons not disabled for fin…
jsx101 Jan 26, 2024
787712c
270124-01 make error log for user clearer
jsx101 Jan 27, 2024
32ad59f
270124-02 default to use forecast price if actual prices don't cover …
jsx101 Jan 27, 2024
e959163
270124-02 log for commodity avg price calculator inputs, and possibly…
jsx101 Jan 27, 2024
77fbbc6
280124-01 disable date check for prov pricing dates for Final
jsx101 Jan 27, 2024
d068730
280124-02 fix forgetten assignment of prov pricing for Final invoice …
jsx101 Jan 27, 2024
4b035fb
280124-03 fix wrong way to get due date for final invoice types
jsx101 Jan 27, 2024
65ec6f7
280124-04 filter out null values in the cashflow json list, add in js…
jsx101 Jan 27, 2024
c529b5c
280124-05 round up or down depending on hours for the due date due to…
jsx101 Jan 27, 2024
63c210a
280124-06 round up for minusBusinessDays function
jsx101 Jan 27, 2024
ca66508
290124-01 open csv in new tab
jsx101 Jan 28, 2024
2eca49e
290124-02 calculation for contained metal for each element
jsx101 Jan 29, 2024
4c81b58
290124-03 fix view document for cashflow function
jsx101 Jan 29, 2024
45b015f
290124-04 evaluate due total by parcels
jsx101 Jan 29, 2024
14d3e23
290124-05 fix unassigned reference day for QP month + n days
jsx101 Jan 29, 2024
c29d862
290124-06 include payments made
jsx101 Jan 29, 2024
64d8aea
290124-07 fix wrong fetching for forecast data
jsx101 Jan 29, 2024
0fa1e49
010224-01 switch to use start date and end date for qp range
jsx101 Feb 1, 2024
f26b856
010224-02 update cashflow for bug fixes and debug logging
jsx101 Feb 1, 2024
83dcbdf
010224-03 REVERTED 02 CHANGES. Change to use qp start and end date ag…
jsx101 Feb 1, 2024
f078fff
010224-04 housekeeping stuffs before major fix
jsx101 Feb 1, 2024
a780225
010224-05 sort cashflow by invoice type, and fix payments eval
jsx101 Feb 1, 2024
0e3e9a3
020224-01 properly parse dry weight from actual invoice; console log …
jsx101 Feb 1, 2024
dc90216
020224-02 more logs for commodity price calc debugging; remove metada…
jsx101 Feb 2, 2024
8631f8d
020224-03 fix Number converting null avg price to 0 when it should us…
jsx101 Feb 2, 2024
070f31d
030224-01 fix json to csv converter and reenabled Download Cashflow b…
jsx101 Feb 3, 2024
6763287
030224-02 fix later downloads problem, and rename download file name
jsx101 Feb 3, 2024
9aceeb2
040224-01 put latest invoice of the same type at the front so it gets…
jsx101 Feb 4, 2024
d74d4f0
180224-02 copy cashflow without doc and open in a new tab
jsx101 Feb 18, 2024
c3ec1e3
180224-03 pad cashflow buttons
jsx101 Feb 18, 2024
80079c1
190224-01 copy buttons for all other doc generators
jsx101 Feb 19, 2024
19cdea8
020324-01 duplicate forecast prices
jsx101 Mar 3, 2024
ff9cece
0703224-01 round evaluated assay/weight table values to 4DP; auto eva…
jsx101 Mar 7, 2024
d2558f8
100324-01 removing the use of pa_cashflow_days and pa_cashflow_day_ty…
jsx101 Mar 10, 2024
ee85b12
110324-01 disable buttons when saving/deleting, esp toggle buttons
jsx101 Mar 11, 2024
cbb9e19
120324-01 overlay to prevent edit when system is making api call to e…
jsx101 Mar 12, 2024
dee378b
160324-01 fixes; convert to lots when creating assay; keep confirm ov…
jsx101 Mar 16, 2024
06cdd63
160324-02 fix cloning new assay lots bug when opening drawer; fix sav…
jsx101 Mar 16, 2024
d083c0f
240324-01 fix wrong boolean value problem
jsx101 Mar 24, 2024
6467513
290324-01 fix unable to delete and add new weight lots problem
jsx101 Mar 29, 2024
1583346
290324-02 sync weight lots button for assay lots drawer
jsx101 Mar 29, 2024
86a5e16
010424-01 fix bug in invoice and cashflow generator
jsx101 Apr 1, 2024
ee05e99
010424-02 more fixes to analytical assay calculation; now stuck on mi…
jsx101 Apr 1, 2024
3221d10
020424-01 switch to use seller assay for assay exchange cert doc
jsx101 Apr 1, 2024
0d74481
020424-02 use checkboxes for toggling between isComposite and not; re…
jsx101 Apr 2, 2024
8ae4898
030424-01 make is composite label bigger in the assay lots drawer
jsx101 Apr 3, 2024
68143d5
120424-01 show price method name in generated invoice, fetch signatur…
jsx101 Apr 12, 2024
c305e6f
120424-02 use doc name only to fetch and display doc from doc display…
jsx101 Apr 12, 2024
f435424
120424-03 remove files
jsx101 Apr 12, 2024
4c30a0c
120424-04 keep space for signature if no signature image is found
jsx101 Apr 12, 2024
88be719
140424-01 remove locally generated test docs and files
jsx101 Apr 14, 2024
6c5a564
150424-01 generated files
jsx101 Apr 15, 2024
cc403fd
160424-01 remove files
jsx101 Apr 16, 2024
fa55e80
180424-01 add logo to the top right corner of each generated doc
jsx101 Apr 18, 2024
4523b6f
180424-02 fix assay values in composite assay drawer page defaulting …
jsx101 Apr 18, 2024
1c47395
180424-03 remove use of STORAGE_LOCAL_ROOT env var since moving to GC…
jsx101 Apr 18, 2024
eeea422
180424-04 stop gap measure until we can fetch and save files to gcs, …
jsx101 Apr 18, 2024
2d7c972
210424-01 use latest assay and weight data by method
jsx101 Apr 21, 2024
4fbc374
210424-02 update fly.toml.template
jsx101 Apr 21, 2024
43591e7
220424-01 update generate and view pdf docs to upload/fetch from GCS
jsx101 Apr 22, 2024
cb63d25
220424-02 remove extra .pdf suffix in the download file name
jsx101 Apr 22, 2024
0668f4a
220424-03 fix wrong mimetype when uploading generated cert of origin
jsx101 Apr 22, 2024
622b650
240424-01 rename related field to contract in commodity table to fix …
jsx101 Apr 24, 2024
1681562
250424-01 WIP adding refining charge to cashflow and inv generator
jsx101 Apr 25, 2024
69e7435
250424-02 update var name and add upload file data param check
jsx101 Apr 25, 2024
1f4494c
250424-03 dynamic storing of generated docs depending on env variable…
jsx101 Apr 25, 2024
61d1f21
270424-01 add uploads folder to gitignore to ignore local files gener…
jsx101 Apr 27, 2024
975b43a
270424-02 qp selection field completed and tested
jsx101 Apr 27, 2024
681f787
280424-01 styling qp selection
jsx101 Apr 28, 2024
c69b02d
040524-01 invoice and cashflow generators using QP selection from Par…
jsx101 May 4, 2024
480953f
180524-01 bracket descriptor for penalty, treatment charge and payabl…
jsx101 May 18, 2024
1cf2d0b
250524-01 fetch folder id to save generated docs into and pass it to …
jsx101 May 25, 2024
f91045f
07062024-01 provide logo and siganture png for generated docs, also c…
jsx101 Jun 7, 2024
1bad44e
070624-02 add no composite assay check for assay ex cert, also remove…
jsx101 Jun 7, 2024
1512406
080624-01 fix bracket type name
jsx101 Jun 8, 2024
dd9299d
090624-01 add null check for parcel form's qp selection, use backup i…
jsx101 Jun 9, 2024
9e2adda
090624-02 fix wrong buyer/seller assay check
jsx101 Jun 9, 2024
aa50248
130624-01 use escalator reference for invoice and cashflow generators
jsx101 Jun 13, 2024
9a2a2db
150624-01 default ref dates to the estimated ones if actual ones are …
jsx101 Jun 15, 2024
77c918c
160624-01 WIP set due date by inv type field for parcel form
jsx101 Jun 16, 2024
a6b5bd4
220624-01 provide qp month in qp selection for parcel
jsx101 Jun 22, 2024
abc317c
250624-01 fix unexpected error when downloading cashflow
jsx101 Jun 25, 2024
9a40fcd
250624-02 bug for date in name fix
jsx101 Jun 25, 2024
9b822c0
290624-01 escalator reference in the penalty section for invoice gene…
jsx101 Jun 29, 2024
f2b3628
290624-02 for final invoice generation, use QP Month + n days
jsx101 Jun 29, 2024
5cee01c
20240706-01 working prototype of invoice due date setter, some proble…
jsx101 Jul 6, 2024
2f46e55
20240706-02 updated qp select to display -- when no qp month
jsx101 Jul 6, 2024
6fd1767
20240706-03 sort inv due date by inv type
jsx101 Jul 6, 2024
53fb8e9
070724-01 invoice generator gets due dates from parcel if set
jsx101 Jul 7, 2024
b2db229
070724-02 bug fix
jsx101 Jul 7, 2024
10bf407
070724-03 fix invoice due date field creating false change when shown…
jsx101 Jul 7, 2024
4a9724f
080724-01 gets previous paid invoice amounts and adds into Payments R…
jsx101 Jul 8, 2024
8a211da
080724-02 included total payments received in the final calc
jsx101 Jul 8, 2024
a2b40c1
080724-03 actually make the amount paid negative so its bracketed
jsx101 Jul 8, 2024
2bb4b55
190724-01 gst for invoice and bracket if monetary value is negative i…
jsx101 Jul 18, 2024
91045c2
190724-02 fix GST data missing message showing up for non GST invoice
jsx101 Jul 19, 2024
97edeee
210724-01 update parseNumber in invoice & cashflow generators to take…
jsx101 Jul 21, 2024
bc8b9eb
240724-01 update and tested out invoice generator with num values, fo…
jsx101 Jul 24, 2024
9b55437
240724-02 wrong check for if gst is applicable for invoice
jsx101 Jul 24, 2024
bccd9df
270724-01 do not save company logo and signature png in generated doc…
jsx101 Jul 27, 2024
e27f897
310724-01 invoice copy will create a revised invoice, max up till 2nd…
jsx101 Jul 31, 2024
a0c59b5
010824-01 a couple of updates and checks
jsx101 Aug 1, 2024
370bcab
030824-01 add in logo & signature image for jpeg, jpg and png file fo…
jsx101 Aug 3, 2024
c855774
070824-080824 all the extension commits, for inv formatting
jsx101 Aug 8, 2024
5a02163
120824-130824 all extension commits from these dates, for styling shi…
jsx101 Aug 13, 2024
3073197
130824-02 fix Moisture column header title
jsx101 Aug 13, 2024
2b1251b
130824-03 move filter date to subheading
jsx101 Aug 13, 2024
7ebcae0
170824-01 Update cert of origin doc generator
jsx101 Aug 17, 2024
43fa7a9
170824-02 update contract and parcel reference for cert of origin in …
jsx101 Aug 17, 2024
f3e5715
200824-01 shrink logo size to 60 60
jsx101 Aug 20, 2024
382bb8a
200824-02 fix weight&assay doc; added bottom margin to header logo; a…
jsx101 Aug 20, 2024
d5ffce4
200824-03 added parcel ref and modified contract ref for weight & assay
jsx101 Aug 20, 2024
589bc49
200824-04 contract ref update for assay exchange generator
jsx101 Aug 20, 2024
c2407a1
200824-05 assay exchange generated doc styled
jsx101 Aug 20, 2024
cb838ea
210824-01 penalty elements styled; and a fix footer line for shipment…
jsx101 Aug 21, 2024
1f873d3
210824-02 loadport disport styling
jsx101 Aug 21, 2024
31d25db
210824-03 bold table header cell titles
jsx101 Aug 21, 2024
40e071f
210824-04 update assay exchange table cell header titles
jsx101 Aug 21, 2024
4b218ee
250824-01 trial secure way to open document
jsx101 Aug 25, 2024
c60ac4d
250824-02 try opening doc securely, test 2
jsx101 Aug 25, 2024
3610b9f
250824-03 test securely opening pdf, part 3
jsx101 Aug 25, 2024
3e72f80
Revert "250824-03 test securely opening pdf, part 3"
jsx101 Aug 25, 2024
45e910a
Revert "250824-02 try opening doc securely, test 2"
jsx101 Aug 25, 2024
de56dad
Revert "250824-01 trial secure way to open document"
jsx101 Aug 25, 2024
31ae8cd
250824-04 fixed bracket description interface
jsx101 Aug 25, 2024
bc4d92e
260824-01 remove access tokens from image fetch for doc generators
jsx101 Aug 26, 2024
54ec818
270824-01 make all the view pdf buttons download pdf for now
jsx101 Aug 27, 2024
d4e6d72
300824-01 make paid gst in usd value negative
jsx101 Aug 30, 2024
8de297b
300824-02 fix find bracket function and give clearer logs if bracket …
jsx101 Aug 30, 2024
b982b30
300824-03 edit invoice payment advice section to look better
jsx101 Aug 30, 2024
d5cebf1
240901-01 logs for invoice generator and bracket description fixes
jsx101 Sep 1, 2024
509aa33
010924-02 use default qp value for qp selection in parcel form
jsx101 Sep 1, 2024
d85f385
010924-03 don't include current day as the business day when adding/d…
jsx101 Sep 1, 2024
c1625af
030924-01 fixed business date evaluators landing on weekends for star…
jsx101 Sep 3, 2024
101a577
030924-02 remove checking provisional pricing end date is weekend sin…
jsx101 Sep 3, 2024
4179b2f
030924-03 the previous 030924-02 has nothing to do with the start dat…
jsx101 Sep 3, 2024
811bcfb
070924-01 fix issue evaluating multiple weight lots because it was st…
jsx101 Sep 7, 2024
b831a18
070924-02 assay table, and invoice and cashflow generators should be …
jsx101 Sep 7, 2024
802e35d
070924-02-1 just removed a log from weight table
jsx101 Sep 7, 2024
756df75
070924-03 all doc generators should be able to use string decimal ass…
jsx101 Sep 7, 2024
f1e24ba
070924-04 fix some logs in loadport disport generator button, and fix…
jsx101 Sep 7, 2024
0e6e088
080924-01 qp declared for invoice generator
jsx101 Sep 8, 2024
2a2b9af
130924-01 account for public holidays by fetching an additional 10 da…
jsx101 Sep 13, 2024
8fab062
150924-01 use latest method from assay lot for assay exchange and wei…
jsx101 Sep 15, 2024
081ced5
200924-01 invoice due date setter, due date estimator based on contract
jsx101 Sep 20, 2024
80795cd
200924-02 invoice due date setter, due date estimator based on contract
jsx101 Sep 20, 2024
2818956
220924-01 got Final invoice due date to be estimated
jsx101 Sep 22, 2024
7c546c0
011024-01 add total adjustments to payable amount instead of invoice …
jsx101 Oct 1, 2024
75b519f
011024-02 remove negative multiplier, the values are already negative
jsx101 Oct 1, 2024
0720b9e
011024-03 round final value from evaluateFinalValueByBracket to 4dp
jsx101 Oct 1, 2024
49ab9f2
041024-01 apply changes to invoice generator on 01-10-2024
jsx101 Oct 4, 2024
d6f2b73
051024-01 invoice generator unit conversion update
jsx101 Oct 5, 2024
dce6a3a
051024-04 & 05 also update how price is calculated in invoice & updat…
jsx101 Oct 5, 2024
cbfbf04
051024-06 replicate invoice update for unit conversion in cashflow ge…
jsx101 Oct 5, 2024
40b57ee
121024-01 fetch gst paid data from invoice form instead of invoice fi…
jsx101 Oct 12, 2024
b0704e0
131024-01 move to new line when Enter in assay and weight lots table
jsx101 Oct 13, 2024
efb4a85
131024-02 don't filter previous invoices by amount paid and gst paid
jsx101 Oct 13, 2024
22977fe
131024-03 skip disabled fields when going to the next input for assay…
jsx101 Oct 13, 2024
d83cb69
151024-01 fix QP Selection options when qp data is updated in contract
jsx101 Oct 15, 2024
0026ea0
261024-02 fix assay exchange check for latest method
jsx101 Oct 26, 2024
76e8a8f
261024-01 fix final assay evaluation
jsx101 Oct 28, 2024
91b070a
261024-02 auto update umpire assay and to umpire field, and disable a…
jsx101 Oct 28, 2024
b9dc5cb
301024-01 invoice generator uses provisional pricing if qp month is a…
jsx101 Oct 30, 2024
30aa29a
021124-01 include base charge adjustment field for charge bracket
jsx101 Nov 2, 2024
ccb34a4
021124-02 typo fix
jsx101 Nov 2, 2024
ba1b0e8
121124-01 parseFloat for decimal inputs for gst and amount paid from …
jsx101 Nov 12, 2024
2fff2c0
201124-01 get business number and show on generated invoice
jsx101 Nov 20, 2024
1a5b2c5
Initial commit of changes for new instance
darrylng Nov 20, 2024
7e874ae
Recommit sensitive files
darrylng Nov 20, 2024
a302150
Dont base64 encode SAs since they are already git-crypt encrypted
darrylng Nov 21, 2024
a0247fb
Merge pull request #1 from navarchtech/dn/brokenhillmines
darrylng Nov 21, 2024
7b745a5
Add git-crypt readme
darrylng Nov 21, 2024
2fd096c
221124-01~02 fix bugs for invoice generator, check extension repo mes…
jsx101 Nov 22, 2024
565f435
jt - this gets BHM instance to have the custom interfaces after deplo…
jsx101 Nov 22, 2024
9c49df6
Fix deploy script, copy fly toml before deploying
darrylng Nov 22, 2024
d1b297a
251124-01 actually catch when date fields in parcel are not filled fo…
jsx101 Nov 24, 2024
2666f91
251124-02 fix wrongly using dry weight for refine/treatment charge ca…
jsx101 Nov 24, 2024
56f60a5
251124-03 fixed issue with total adjustments being minused from payab…
jsx101 Nov 24, 2024
5d10fa9
251124-03 should be deducting adjustments from Invoice Value, not out…
jsx101 Nov 24, 2024
786908e
251124-01 fix so TC uses dry weight and RC uses payable metal weight
jsx101 Nov 25, 2024
658b782
261124-01 make seller phone code and phone number not mandatory for d…
jsx101 Nov 25, 2024
6daed91
261124-02 fix title for weight and assay cert doc generator, remove l…
jsx101 Nov 25, 2024
a3fa95e
271124-01 invoice & cashflow doc generators can pick AM PM or Average…
jsx101 Nov 26, 2024
5f869eb
041224-01 fixed cashflow to show 2dp dry weight and no dry weight uom…
jsx101 Dec 4, 2024
5a3e9ce
041224-02 QP fixed issue with QP all showing Oct 24 for the 2nd cashflow
jsx101 Dec 4, 2024
e1ce106
041224-03 cashflow: split parcel data fetch into chunks of 15 parcel …
jsx101 Dec 4, 2024
f236c36
041224-04 same shit as before but for fetching invoices of existing p…
jsx101 Dec 4, 2024
ec2d933
041224-05 fix qp period for cashflow
jsx101 Dec 4, 2024
66f3182
Clean up start.sh script
darrylng Dec 4, 2024
054051c
Fix deploy step to build docker image correctly
darrylng Dec 4, 2024
c998b6a
041224-06 use default qp if qp is not selected
jsx101 Dec 4, 2024
ce03626
Merge branch 'main' of https://github.com/navarchtech/navarch-fly
jsx101 Dec 4, 2024
c781629
041224-07 better log message for cashflow and backup again if getting…
jsx101 Dec 4, 2024
8be385b
051224-01 better log for identifying parcel and invoice type that err…
jsx101 Dec 4, 2024
dbbd18c
051224-02 fix boolean expr in cashflow doc generator
jsx101 Dec 4, 2024
bd186c9
051224-03 don't set the start of forecast date as the new date for pr…
jsx101 Dec 4, 2024
e82a939
061224-01 cashflow now uses Invoice Due Date from Parcel form over es…
jsx101 Dec 6, 2024
00df719
061224-02 remove dry weight uom and make it only 2 decimal places whe…
jsx101 Dec 6, 2024
fd879fa
061224-03 fix how the tc/rc and penalties are "added" to the final value
jsx101 Dec 6, 2024
47b2a4a
061224-04 fix copy forecast price for cashflow
jsx101 Dec 6, 2024
b432edb
Readd navarch instance templates
darrylng Dec 9, 2024
69247ac
171224-01 fix contained metal conversion problem for cashflow
jsx101 Dec 17, 2024
8886935
181224-02 moved the columns around
jsx101 Dec 18, 2024
7d0d9ec
181224-03 also rearranged columns for valuation inv rows, and move To…
jsx101 Dec 18, 2024
9c51c71
181224-04 optionally render TC for commodity if data exists, also add…
jsx101 Dec 18, 2024
c7a4bd3
181224-05 properly calculates Due Total based on invoices that aren't…
jsx101 Dec 18, 2024
2af7245
181224-06 better logs and better if-check for cashflow
jsx101 Dec 18, 2024
4016f64
181224-07 better log for debugging
jsx101 Dec 18, 2024
18e7af1
181224-07 console logging the sorted list of inv types
jsx101 Dec 18, 2024
7690fdc
181224-08 use forEach instead of Promise.all to iterate over all cont…
jsx101 Dec 18, 2024
88fcef7
181224-09 don't use forEach with async callback, using for...of to it…
jsx101 Dec 18, 2024
bfbae03
181224-10 this should fix the extra invoice before the earliest one i…
jsx101 Dec 18, 2024
12e62d8
181224-11 commodity price calc for cashflow
jsx101 Dec 18, 2024
f7fb660
181224-12 fix wrong fetch for cashflow after renaming parcel payable …
jsx101 Dec 18, 2024
b28a11c
191224-01 move the 'add previous invoice for Due Total calc' part out…
jsx101 Dec 19, 2024
72dd31b
191224-02 fixed why one of the valuation invoice tried to get forecas…
jsx101 Dec 19, 2024
ec221c5
201224-01 fixex 'contract is not defined' error
jsx101 Dec 20, 2024
748a761
221224-01 exclude existing invoices that have already been paid for
jsx101 Dec 22, 2024
3babb82
231224-01 move Total Revenues USD column
jsx101 Dec 23, 2024
b8c502b
311224-01 GST calculation for cashflow, untested
jsx101 Dec 30, 2024
5b890b1
301224-02 added dry weight uom column for cashflow
jsx101 Dec 30, 2024
6b2e456
060125-01 keep cashflow final columns at the end
jsx101 Jan 6, 2025
ac6684c
070125-01 also move to new cell in assay/weight lots table when numpa…
jsx101 Jan 7, 2025
2304f14
100124-01 add "Tax" in the invoice title if GST is applicable
jsx101 Jan 10, 2025
366cea7
100124-02 rearrange cashflow column Total Revenues USD
jsx101 Jan 10, 2025
e3a18db
130125-01 put the invoice header in one line span the entire row
jsx101 Jan 13, 2025
5c3a933
140125-01 got existing invoices to be included too. Existing code wil…
jsx101 Jan 14, 2025
7c2cda8
150125-01/02 weight lots display
jsx101 Jan 15, 2025
a44f86f
150125-03 format display number for weight lots
jsx101 Jan 15, 2025
bb396bc
150125-04 assay lots display for parcel home page
jsx101 Jan 15, 2025
cd0bbf5
180125-01 sort assay lots by primary comm first and penalty element last
jsx101 Jan 18, 2025
7a678b9
WIP: Guardrails to stop deploying to wrong client
darrylng Jan 12, 2025
ef47e63
Intro navarch with Directus 11
darrylng Jan 21, 2025
9bf5a47
Add secrets
darrylng Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/snapshots
**/seed
.gitignore
4 changes: 4 additions & 0 deletions .git-crypt/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Do not edit this file. To specify the files to encrypt, create your own
# .gitattributes file in the directory where your files are.
* !filter !diff
*.gpg binary
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
templates/envs/** filter=git-crypt diff=git-crypt
templates/secrets/** filter=git-crypt diff=git-crypt
templates/tomls/** filter=git-crypt diff=git-crypt
24 changes: 24 additions & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
strategy:
matrix:
instance: ["navarch", "navarch-11", "brokenhillmines"]
steps:
- uses: actions/checkout@v4
- name: Set up Flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Set APP_NAME
run: echo "APP_NAME=${{ matrix.instance }}" >> $GITHUB_ENV
- name: Source environment variables
run: |
./deploy.sh ${{ matrix.instance }}
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,17 @@ dist

# TernJS port file
.tern-port

**/snapshots

*.DS_Store

# Generated by flyctl launch with our template
fly.toml

nav-apps-dev-71da-e069131b2888.json

uploads/

package-lock.json
package.json
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ image:
file: .gitpod.Dockerfile

ports:
- port: 3000
- port: 8055
onOpen: notify

tasks:
Expand Down
41 changes: 31 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# base node image
FROM node:16-bullseye-slim as base
FROM node:18.17-bullseye-slim AS base

# set for base and all layer that inherit from it
ENV NODE_ENV production
ENV NODE_ENV=production

RUN apt-get update && apt-get install -y openssl sqlite3
RUN apt-get update && \
apt-get install -y --no-install-recommends openssl sqlite3 python3 build-essential postgresql-client && \
rm -rf /var/lib/apt/lists/* && \
yarn config set python /usr/bin/python3

# Install all node_modules, including dev dependencies
FROM base as deps
FROM base AS deps

WORKDIR /myapp

ADD package.json .npmrc ./
RUN npm install --production=false
# --target_arch=x64 --target_platform=linux --target_libc=glibc

# Setup production node_modules
FROM base as production-deps
FROM base AS production-deps

WORKDIR /myapp

Expand All @@ -26,17 +30,34 @@ RUN npm prune --production
# Finally, build the production image with minimal footprint
FROM base

ENV DATABASE_URL=file:/data/database/data.db
ENV PORT="6055"
ENV PORT="8055"
ENV NODE_ENV="production"

# add shortcut for connecting to database CLI
RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli
# RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli

WORKDIR /myapp

COPY --from=production-deps /myapp/node_modules /myapp/node_modules
ARG APP_NAME
ENV APP_NAME=${APP_NAME}

ADD . .
# TODO: Use ARG to pass in which env and toml file to use
COPY --from=production-deps /myapp/node_modules /myapp/node_modules
COPY ./uploads/. /myapp/uploads/.
COPY ./templates/secrets/${APP_NAME}/. .
COPY ./templates/envs/${APP_NAME}.env .env
COPY ./templates/tomls/fly.${APP_NAME}.toml fly.toml
COPY ./templates/deps/${APP_NAME}/package.json package.json
COPY ./templates/deps/${APP_NAME}/package-lock.json package-lock.json

# TODO: This is potentially adding other companies secrets.
# May be better to add files individually which are needed.
# ADD . .

# Seed not ready yet
# ADD seed ./seed
COPY extensions ./extensions
COPY fonts ./fonts
COPY start.sh .

CMD ["bash", "start.sh"]
137 changes: 137 additions & 0 deletions README.gitcrypt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# Granting Access to a `git-crypt` Encrypted Repository

This guide explains how to securely grant another user access to a `git-crypt` encrypted repository.

---

## TL;DR (Quick Commands)

### For the User Requesting Access (Person B)

```bash
# Generate GPG key pair
gpg --full-generate-key

# Export and share public key
gpg --export --armor <[email protected]> > your-public-key.asc
```

### For the Repository Admin (Person A)

```bash
# Import the public key of the user requesting access
gpg --import their-public-key.asc

# Add the user to git-crypt
git-crypt add-gpg-user [email protected]

# Commit and push changes
git add .
git commit -m "Grant access to [email protected]"
git push
```

### For the New User (Person B)

```bash
# Clone the repository
git clone <repository-url>
cd <repository-directory>

# Unlock with your private key
git-crypt unlock
```

---

## Detailed Steps

### 1. User Requesting Access (Person B)

Person B generates their GPG key pair and shares their public key with the repository admin.

```bash
# Generate GPG key pair
gpg --full-generate-key
```

#### Choose these options during setup:

- **Key type:** RSA and RSA
- **Key size:** 4096 bits
- **Key validity:** 0 (does not expire)
- **Email address:** Enter your email (e.g., `[email protected]`)
- **Passphrase:** Set a secure passphrase.

Export the public key:

```bash
gpg --export --armor [email protected] > b-public-key.asc
```

Send the `b-public-key.asc` file to Person A.

---

### 2. Repository Admin (Person A)

Person A adds Person B's public key to the repository.

1. **Import the public key:**

```bash
gpg --import b-public-key.asc
```

2. **Grant access using `git-crypt`:**

```bash
git-crypt add-gpg-user [email protected]
```

3. **Commit and push changes:**

```bash
git add .
git commit -m "Grant access to [email protected]"
git push
```

---

### 3. User Unlocking the Repository (Person B)

Once Person B has been added, they can access the repository.

1. Clone the repository:

```bash
git clone <repository-url>
cd <repository-directory>
```

2. Unlock the repository:

```bash
git-crypt unlock
```

This will use Person B's private key to decrypt the files.

---

## Key Points

- **Private/Public Key Responsibilities:**
- The user requesting access (Person B) generates their own key pair.
- Only the public key is shared with the repository admin (Person A).

- **Security of Private Key:**
- The private key should never be shared. It is used locally to unlock the encrypted files.

- **Revocation:**
- Access can be revoked by removing the public key from `git-crypt` and re-encrypting the repository.

---

Include this guide in your repository to simplify the onboarding process for users requesting access!
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ You can change this by following Fly's DNS docs and then just update the secret
We also need to create a volume in Fly to persist our app data (SQLite DB) so that Fly can persist the data stored across deployments and container restarts. Again, we can do that using the Fly command line.

```bash
flyctl volumes create data --region [REGION] --size 1
flyctl volumes create data --region [REGION] --size 1 --yes
```

> Note: REGION should be the region selected when launching the app. You can check the region chosen by running `flyctl regions list`.
Expand All @@ -101,7 +101,7 @@ We are ready for our first deployment.

You have two ways to deploy:

- Via `npm run deploy`: deploy the current folder
- Via `npm run deploy`: deploy the current folder (this has memory set to 512MB, otherwise Directus will crash with OOM)
- Via Github actions.

GitHub actions workflows are configured to run on push to the `main` branch.
Expand Down Expand Up @@ -133,3 +133,41 @@ There are two ways to add extensions:
2. Installed inside the `extensions` folder.

This works the same as any other Directus installation

### Fetching files from the live app
Run the following command to fetch files from the project root
`fly sftp get <REMOTE_FILE_PATH> <LOCAL_FILE_PATH_TO_SAVE_TO>`

To check if the file is there, run the following command instead
`fly sftp find <REMOTE_FILE_PATH>`

### Stop/start the current machine
To stop a running machine, run `fly machine stop` in the project root.

To start a stopped machine, run `fly machine start` in the project root.

For both commands, options will appear, select the machine by pressing Spacebar and hit Enter.

### New features to deploy
Run `npm run deploy` and wait for health check to complete. If it fails, then will need to check Monitoring logs to debug.

## Debugging
### Database
```
If it cannot find the data.db file location, it is possible that a .dockerignore file was generated and configured to ignore the .env file. If that is the case, comment it out from the .dockerignore file. This is a temporary solution until a better way to pass in configs is found.
```

### Deployment
For this error
```
Error failed to fetch an image or build from source: error connecting to docker: failed building options: failed probing “navarch”: context deadline exceeded
```

Run the following commands
```
fly version update (get the latest version, or however you prefer to do that)
fly wireguard websockets enable
fly xxxx (whatever flyctl commands you wanted to run when you got the error)
```

If that fails, run `fly doctor report` to debug further
28 changes: 28 additions & 0 deletions README.newinstance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Create New Instance For New Client

## Prerequisite

1. Ensure flyctl / fly CLI is [installed](https://fly.io/docs/flyctl/install/), then use `fly auth login` to login to your fly.io account on which you've been added to the navarch org.

## Steps

1. Create a new project in [Neon](https://console.neon.tech/). Then, make sure a few steps are done here:
- Go to the dashboard of the new DB and select "Create Database" and create a new one called `navarch_db` where we'll use instead of the default of `neondb`.
- Then, select "Create Role" and create a new one called `admin` where we'll use instead of the default of `neondb_onwer`. These are important steps for data seeding to work correctly.
2. Create a new app in the fly.io [Navarch org](https://fly.io/dashboard/navarch). This is best done using [script](./deploy.sh).
3. Create a [new service account](https://console.cloud.google.com/iam-admin/serviceaccounts?project=nav-apps-prd-7443&supportedpurview=project) with the naming convention of `nav-[client_name]`. **DO NOT** grant any roles when creating the service account. We don't want this service account to have access to other buckets in other companies.
4. Create a [new bucket in GCP](https://console.cloud.google.com/storage/browser?project=nav-apps-prd-7443) to store client data. Use the exact same naming convention of `nav-[client_name]`.
5. Navigate to the newly created bucket, select the "Permission" tab and add the service account as "Storage Object Admin" to this bucket. The principal to add is for example: `nav-[client_name]@nav-apps-prd-7443.iam.gserviceaccount.com`.
6. Navigate back to the Service Account that was newly created, create a new JSON key. Store the file into the secrets directory.
7. Duplicate and populate important information for the `.toml` and `.env` files:
- Create a new file in [tomls](./templates/tomls/) for the new client, populate important info.
- Create a new file in [envs](./templates/envs/) for the new client, populate important info.
8. Deploy the changes to fly.io under the navarch org. To do that, you'll need to copy some sensitive values from the `[client_name].env` file and replace the `deploy.sh` script, and run `./deploy.sh [clientname]` to deploy to fly.io. Make sure you open the URL to kick start the application and iterate the configs until you get a successful instance running.
- Be sure to update the Dockefile if deploying for 'navarch' test instance
9. We can now seed the database (`navarch_db`) with our data.
- Depending on whether you have a clean export of a database we can start with, you may need to dump it from a known good Navarch instance. Inspect the [db-1-backup.sh](./db-1-backup.sh) and change the env path before running to dump a copy of `navarch_*` schemas to your local machine.
- Then, inspect the [db-2-restore.sh](./db-2-restore.sh) and change the env path before running to load the dumped data into the new database for the new client.
10. Enter Neon DB console again and enter the newly seeded database. Delete from the following tables everything that can be deleted that are not constrained by deletions, or use the [db-3-restore.sh](./db-3-cleanup.sh) script to perform a clean up of the new instance.
- directus_files
- directus_users
- directus_activity
Binary file added data.db
Binary file not shown.
Loading