Skip to content

Commit

Permalink
Changes Done Properly
Browse files Browse the repository at this point in the history
  • Loading branch information
parthpetkar committed May 1, 2024
1 parent 3bec6eb commit ab518ef
Show file tree
Hide file tree
Showing 11 changed files with 335 additions and 401 deletions.
36 changes: 11 additions & 25 deletions Backend/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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 = [];

Expand Down Expand Up @@ -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)
Expand All @@ -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();
Expand Down
36 changes: 22 additions & 14 deletions Backend/milestonepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,36 @@ $(document).ready(async () => {
row.append(`<td>${project ? project.project_name : 'N/A'}</td>`); // Check if project exists
row.append(`<td>${milestone.milestone_name}</td>`);
row.append(`<td>${invoice ? formatDate(invoice.due_date) : 'N/A'}</td>`); // Update this with the actual due date field
row.append(`<td>${invoice ? formatCurrency(invoice.remaining_amount) : 'N/A'}</td>`); // Remaining Amount);
row.append(`<td>${invoice ? formatCurrency(milestone.amount) : 'N/A'}</td>`); // Remaining Amount);

// Status - Use the status from the milestone object
const statusCell = $('<td>'); // Create a cell for the status
if (invoice) {
if (invoice && milestone.status !== 'paid') {
const payButton = $('<button>').addClass('pay-btn').text('Pay'); // Create the "Pay" button
payButton.click(function () {
// Hide the button
$(this).hide();
payButton.click(async function () {
try {
// Hide the button
$(this).hide();

// Get the row index
const rowIndex = $(this).closest('tr').index();
// Get the row index
const rowIndex = $(this).closest('tr').index();

// Update the status to "paid"
invoices[rowIndex].status = 'paid';
// Update the status to "paid"
milestone.status = 'paid';

// Update the corresponding cell text
statusCell.text('Paid');
// Update the corresponding cell text
statusCell.text('Paid');

// You might need to send an update request to your backend here to update the status in the database
// Send a request to update the milestone status
await window.electron.send('paidstatus', { milestone });
} catch (error) {
console.error('Error paying milestone:', error);
// Handle error if necessary
}
});
statusCell.append(payButton);
} else if (invoice && milestone.status === 'paid') {
statusCell.text('Paid');
} else {
statusCell.text('N/A');
}
Expand All @@ -58,6 +66,6 @@ $(document).ready(async () => {
return parseFloat(amount).toLocaleString('en-IN', { style: 'currency', currency: 'INR' });
};

await window.electron.send('updatestatus', milestone)
// await window.electron.send('updatestatus', milestone)
});
});
});
137 changes: 28 additions & 109 deletions CSS/create_customer.css
Original file line number Diff line number Diff line change
@@ -1,132 +1,51 @@
.form-container {
#customer_form {
padding-left: 20px;
padding-right: 20px;
animation: slideIn 0.5s forwards;
animation: slideIn 1s forwards;
}

@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-50px);
}

to {
opacity: 1;
transform: translateY(0);
}
}

.form-group button:hover {
background-color: #0056b3;
}

.multiPageForm ul.tabs {
overflow: hidden;
list-style-type: none;
margin: 0;
padding: 0;
}

.multiPageForm ul.tabs li {
float: left;
width: 25%;
text-align: center;
}

.multiPageForm ul.tabs li a {
display: block;
padding: 10px;
text-decoration: none;
color: #333;
background-color: #f4f4f4;
}

.multiPageForm ul.tabs li a:hover {
background-color: #ddd;
}

.multiPageForm ul.tabs li.is-active a {
background-color: #007bff;
color: #fff;
}

.tabs-panel {
display: none;
padding: 20px;
border: 1px solid #ccc;
}

.tabs-panel.is-active {
display: block;
}

#myForm {
max-width: 600px;
margin: auto;
padding: 30px;
background: #f4f4f4;
border-radius: 8px;
}

#myForm h1 {
#customer_form h1 {
margin: 0 0 30px 0;
text-align: center;
color: #fff;
color: #333;
}

#myForm .form-group {
#customer_form .form-group {
margin-bottom: 20px;
}

#myForm .form-group label {
#customer_form .form-group label {
display: block;
margin-bottom: 8px;
color: black;
font-weight: bold;
}

#myForm .form-group input {
width: 95%;
padding: 8px;
border: none;
font-size: 16px;
background-color: #e8eeef;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03) inset;
}

#tax,
#tax_type {
margin-bottom: 20px;
}

#tax label,
#tax_type label {
display: block;
color: #333;
/* Dark text color */
font-weight: bold;
margin-bottom: 5px;
color: black;
}

#tax select,
#tax_type select {
width: 100%;
padding: 8px;
#customer_form .form-group input {
width: calc(100% - 16px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #e8eeef;
color: #8a97a0;
font-size: medium;
background-color: #f9f9f9;
/* Light background color */
color: #333;
/* Dark text color */
font-size: 16px;
}

#tax_type select {
height: 100px;
margin-top: 5px;
.error {
color: red;
}

#create_milestone {
margin-top: 10px;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(-50px);
}

.deleteBtn {
margin-left: 10px;
}
to {
opacity: 1;
transform: translateY(0);
}
}
Loading

0 comments on commit ab518ef

Please sign in to comment.