From 11e572c414eb872ccf5c61d4d63bcb3f32fa72cc Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Mon, 3 Nov 2025 11:59:00 +0800 Subject: [PATCH 1/2] Defaulted to localhost --- backend/main.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/backend/main.go b/backend/main.go index b1882ab..295ad69 100644 --- a/backend/main.go +++ b/backend/main.go @@ -18,12 +18,12 @@ import ( ) // DEV -// var connection string = "root:superuser@tcp(localhost:3306)/iips" -// var connectionPops string = "root:superuser@tcp(localhost:3306)/pops" +var connection string = "root:superuser@tcp(localhost:3306)/iips" +var connectionPops string = "root:superuser@tcp(localhost:3306)/pops" // SERVER -var connection string = "iips:iipsuser@tcp(192.168.7.100:3306)/iips" -var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops" +// var connection string = "iips:iipsuser@tcp(192.168.7.100:3306)/iips" +// var connectionPops string = "pops:Pops2023!@tcp(192.168.76.10:3306)/pops" func main() { connect() @@ -44,23 +44,23 @@ func connect() { router.Use(cors.Default()) //DEV - // router.Use(cors.New(cors.Config{ - // AllowOrigins: []string{"http://localhost:5173"}, - // AllowMethods: []string{"GET", "POST"}, - // AllowHeaders: []string{"Origin", "OCBO-ShieldConnection"}, - // ExposeHeaders: []string{"Content-Length"}, - // AllowCredentials: true, - // })) - - //SERVER router.Use(cors.New(cors.Config{ - AllowAllOrigins: true, + AllowOrigins: []string{"http://localhost:5173"}, AllowMethods: []string{"GET", "POST"}, - AllowHeaders: []string{"Origin"}, + AllowHeaders: []string{"Origin", "OCBO-ShieldConnection"}, ExposeHeaders: []string{"Content-Length"}, AllowCredentials: true, })) + //SERVER + // router.Use(cors.New(cors.Config{ + // AllowAllOrigins: true, + // AllowMethods: []string{"GET", "POST"}, + // AllowHeaders: []string{"Origin"}, + // ExposeHeaders: []string{"Content-Length"}, + // AllowCredentials: true, + // })) + router.StaticFile("/", "static/index.html") // shield := "inquiry" From 10dd5b7fa99d7b8544aea038a350e54feb8e8a4b Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Mon, 3 Nov 2025 11:59:45 +0800 Subject: [PATCH 2/2] Fixed pdf --- src/utils/functions/createPdf.ts | 116 ++++++++++++++++--------------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/src/utils/functions/createPdf.ts b/src/utils/functions/createPdf.ts index 81c43d9..9b23f6d 100644 --- a/src/utils/functions/createPdf.ts +++ b/src/utils/functions/createPdf.ts @@ -25,9 +25,9 @@ export default async () => { const APPROVERID = 276 const doc = new jsPDF({ - orientation: 'l', + orientation: 'p', unit: 'mm', - format: [150.03, 215.9], + format: [215.9, 279.4], }) const arial = @@ -57,7 +57,7 @@ export default async () => { fontSize: 32, textColor: '#000000', x: pageWidth - 35, - y: 40, + y: 38, textOptions: { align: 'center' }, }) @@ -118,131 +118,137 @@ export default async () => { const opTextX = (pageWidth - opTextWidth) / 2 doc.setFont('arial-bold', 'bold') doc.setFontSize(9) - doc.text(opText, opTextX, 36) + doc.text(opText, opTextX, 34) const divisionText = 'ELECTRICAL PERMIT' const divisionTextWidth = getTextWidth(divisionText, 7.25) const divisionTextX = (pageWidth - divisionTextWidth) / 2 doc.setFont('arial', 'normal') doc.setFontSize(8) - doc.text(divisionText, divisionTextX, 40) + doc.text(divisionText, divisionTextX, 38) const optnText = 'OPTN:' const optnTextX = 16 doc.setFont('arial-bold', 'bold') doc.setFontSize(8) - doc.text(optnText, optnTextX, 48) + doc.text(optnText, optnTextX, 38) const optnContentX = 25 doc.setFontSize(8) - doc.text(OPTN, optnContentX, 48) + doc.text(OPTN, optnContentX, 38) const toText = `TO: The City Treasurer's Office` const toTextX = 16 doc.setFont('arial', 'normal') doc.setFontSize(8) - doc.text(toText, toTextX, 52) + doc.text(toText, toTextX, 46) - doc.text('Please accept payment for fee specified herunder', 16, 56) + doc.text('Please accept payment for fee specified herunder', 16, 50) - doc.text('Application No. :', pageWidth - 60, 48) + doc.text('Application No. :', pageWidth - 60, 46) doc.setFont('arial-bold', 'bold') - doc.text(APPLICATION, pageWidth - 38, 48) + doc.text(APPLICATION, pageWidth - 38, 46) doc.setFont('arial', 'normal') - doc.text('Approved Date :', pageWidth - 60, 52) + doc.text('Approved Date :', pageWidth - 60, 50) doc.setFont('arial-bold', 'bold') - doc.text(DATE, pageWidth - 38, 52) + doc.text(DATE, pageWidth - 38, 50) doc.setFont('arial', 'normal') - doc.text('Name of Applicant :', 23.4, 64) + doc.text('Name of Applicant :', 23.4, 58) doc.setFont('arial-bold', 'bold') - doc.text(NAME, 50, 64) + doc.text(NAME, 50, 58) doc.setFont('arial', 'normal') - doc.text('Location of Construction :', 16, 68) + doc.text('Location of Construction :', 16, 62) doc.setFont('arial-bold', 'bold') - doc.text(LOCATION, 50, 68) + doc.text(LOCATION, 50, 62) doc.setFont('arial', 'normal') - doc.text('Type of Use :', 31.2, 72) + doc.text('Type of Use :', 31.2, 66) doc.setFont('arial-bold', 'bold') - doc.text(TYPE, 50, 72) + doc.text(TYPE, 50, 66) - doc.text('ACCOUNT DESCRIPTION', 16, 84) - doc.text('ACCOUNT CODE', getTextWidth('ACCOUNT DESCRIPTION', 8) + 40, 84) - doc.text('AMOUNT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 65, 84) + doc.text('ACCOUNT DESCRIPTION', 16, 74) + doc.text('ACCOUNT CODE', getTextWidth('ACCOUNT DESCRIPTION', 8) + 40, 74) + doc.text('AMOUNT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 65, 74) + doc.text('UNIT', getTextWidth('ACCOUNT DESCRIPTION', 8) + getTextWidth('ACCOUNT CODE', 8) + 82, 74) doc.setFont('arial', 'normal') - // doc.text('SAMPLE FEE', 16, 92) - // doc.text('ANOTHER SAMPLE FEE', 16, 96) - let yPosition = 92 + let yPosition = 82 FEES.forEach((fee) => { doc.text(fee, 16, yPosition) yPosition += 4 }) - yPosition = 92 + yPosition = 82 CODES.forEach((code) => { doc.text(code, 76, yPosition) yPosition += 4 }) - yPosition = 92 + yPosition = 82 AMOUNTS.forEach((amount) => { doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 122, yPosition) yPosition += 4 }) - doc.text('x1', 140, 92) - doc.text('x1', 140, 96) - doc.text('=', 148, 92) - doc.text('=', 148, 96) + doc.text('x1', 140, 82) + doc.text('x1', 140, 86) + doc.text('=', 148, 82) + doc.text('=', 148, 86) - yPosition = 92 + yPosition = 82 AMOUNTS.forEach((amount) => { doc.text(`${PESO} ${parseInt(amount).toFixed(2)}`, 156, yPosition) yPosition += 4 }) + let newYPosition = yPosition + console.log(newYPosition) + + doc.line(156, newYPosition, 170, newYPosition) + doc.setFont('arial-bold', 'bold') - doc.text('Assessed By :', 16, 108) - doc.text('Approved By :', 142, 108) + doc.text('Total :', 146, newYPosition + 4) + const totalAmount = AMOUNTS.reduce((sum, amount) => sum + parseFloat(amount), 0) + doc.text(`${PESO} ${totalAmount.toFixed(2)}`, 156, newYPosition + 4) - doc.text(ASSESSOR, 16, 126) - doc.text(APPROVER, 142, 126) + doc.text('Assessed By :', 16, newYPosition + 12) + doc.text('Approved By :', 142, newYPosition + 12) + doc.text(ASSESSOR, 16, newYPosition + 30) + doc.text(APPROVER, 142, newYPosition + 30) + + doc.addImage(assessorQr, 'PNG', 16, newYPosition + 14, 14, 14, 'assessorQr', 'NONE', 0) + doc.addImage(_signatureAssessor.get(), 'PNG', 30, newYPosition + 14, 10, 5.9, 'signatureAssessor', 'NONE', 0) doc.setFont('arial', 'normal') - doc.setFontSize(6) - doc.text('Officer-in-Charge', 154, 129) - // doc.text(CODE, 76, 96) + doc.setFontSize(4) + doc.text('Digitally signed by :', 30, newYPosition + 22) + doc.text(ASSESSOR, 30, newYPosition + 24) + doc.text('Date: ' + dayjs(_assessedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 30, newYPosition + 26) + + doc.addImage(approverQr, 'PNG', 142, newYPosition + 14, 14, 14, 'approverQr', 'NONE', 0) + doc.addImage(_signatureApprover.get(), 'PNG', 156, newYPosition + 14, 41.4, 5.9, 'signatureApprover', 'NONE', 0) + doc.text('Digitally signed by :', 156, newYPosition + 22) + doc.text(APPROVER, 156, newYPosition + 24) + doc.text('Date: ' + dayjs(_approvedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 156, newYPosition + 26) doc.setFont('arial-bold', 'bold') doc.setFontSize(7) - doc.text('Please use the OPTN when paying online.', 16, 140) - const note = doc.splitTextToSize('Note: The 72 Hours Transaction Policy of the City Mayor, shall commence upon submission of the Bureau of Fire Protection clearance/certificate and other requirement stated in the notice to comply to be issued by this office.', 185) - doc.text(note, 16, 144) + doc.text('Please use the OPTN when paying online.', 16, newYPosition + 40) + const note = doc.splitTextToSize('Note: The 72 Hours Transaction Policy of the City Mayor, shall commence upon submission of the Bureau of Fire Protection clearance/certificate and other requirement stated in the notice to comply to be issued by this office.', newYPosition + 44) + doc.text(note, 16, newYPosition + 44) - doc.addImage(_signatureAssessor.get(), 'PNG', 30, 110, 10, 5.9, 'signatureAssessor', 'NONE', 0) doc.setFont('arial', 'normal') - doc.setFontSize(4) - doc.text('Digitally signed by :', 30, 118) - doc.text(ASSESSOR, 30, 120) - doc.text('Date: ' + dayjs(_assessedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 30, 122) - - doc.addImage(_signatureApprover.get(), 'PNG', 156, 110, 41.4, 5.9, 'signatureApprover', 'NONE', 0) - doc.text('Digitally signed by :', 156, 118) - doc.text(APPROVER, 156, 120) - doc.text('Date: ' + dayjs(_approvedDate.get()).format('YYYY-MM-DD HH:mm:ss'), 156, 122) - - doc.addImage(assessorQr, 'PNG', 16, 110, 14, 14, 'assessorQr', 'NONE', 0) - doc.addImage(approverQr, 'PNG', 142, 110, 14, 14, 'approverQr', 'NONE', 0) + doc.setFontSize(6) + doc.text('Officer-in-Charge', 154, newYPosition + 33) doc.save(`OP-${APPLICATION}.pdf`) }