diff --git a/Backend/customer.js b/Backend/customer.js
index ec953be..41b4769 100644
--- a/Backend/customer.js
+++ b/Backend/customer.js
@@ -46,20 +46,21 @@ $(document).ready(async () => { //it waits for html to load
});
// Save project data when save button on panel 2 is clicked
- $('#saveProject').on('click', function () {
+ $("#saveProject").click(async () => {
projectData = saveProjectData();
- });
-
- try {
- $('#back_btn').click(async (e) => {
+ try {
+ await window.electron.send('createProject', { projectData });
e.preventDefault();
- $('#milestone_table').hide();
- $('#customer_form').show();
- });
-
+ $('#milestone_table').show();
+ $('#customer_form').hide();
+ }
+ catch (error) {
+ console.log(error);
+ }
+ })
+ try {
const tax = $('#taxes_select').val();
- const tax_options = $('#tax_type_select').val();
if (tax === true) {
$('#tax_type').show();
}
@@ -72,11 +73,6 @@ $(document).ready(async () => { //it waits for html to load
$('#tax_type').hide();
}
});
- $('#tax_type_select').change(function () {
- const tax_options = $(this).val();
- })
- const table = $("#dataTable");
-
let rowDataArray = [];
@@ -163,7 +159,6 @@ $(document).ready(async () => { //it waits for html to load
$("#create_milestone").click(async () => {
try {
- //await window.electron.send('createCustomer', { customerData });
await window.electron.send('insertMilestone', { rowDataArray, projectData });
} catch (error) {
console.log(error)
@@ -173,20 +168,11 @@ $(document).ready(async () => { //it waits for html to load
$("#saveCustomer").click(async () => {
try {
await window.electron.send('createCustomer', { customerData });
- // await window.electron.send('insertmilestone', { rowDataArray });
} catch (error) {
console.log(error)
}
});
- $("#saveProject").click(async () => {
- try {
- await window.electron.send('createProject', { projectData });
- }
- catch(error) {
- console.log(error);
- }
- })
const { company_name } = await window.electron.invoke('fetchCustomer');
$('#customerSelect').empty();
diff --git a/Backend/milestonepage.js b/Backend/milestonepage.js
index 2dca925..40430c2 100644
--- a/Backend/milestonepage.js
+++ b/Backend/milestonepage.js
@@ -17,28 +17,36 @@ $(document).ready(async () => {
row.append(`
${project ? project.project_name : 'N/A'} | `); // Check if project exists
row.append(`${milestone.milestone_name} | `);
row.append(`${invoice ? formatDate(invoice.due_date) : 'N/A'} | `); // Update this with the actual due date field
- row.append(`${invoice ? formatCurrency(invoice.remaining_amount) : 'N/A'} | `); // Remaining Amount);
+ row.append(`${invoice ? formatCurrency(milestone.amount) : 'N/A'} | `); // Remaining Amount);
// Status - Use the status from the milestone object
const statusCell = $(''); // Create a cell for the status
- if (invoice) {
+ if (invoice && milestone.status !== 'paid') {
const payButton = $(' |