From f0bf773985b4ea533435d0444b658b3fcbf1e149 Mon Sep 17 00:00:00 2001 From: sonali Date: Mon, 23 Dec 2024 18:56:08 +0530 Subject: [PATCH 1/3] " expense and purchase , settings and payroll manage user first page " --- src/assets/css/App.css | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/assets/css/App.css b/src/assets/css/App.css index c89fe4c..b2db589 100644 --- a/src/assets/css/App.css +++ b/src/assets/css/App.css @@ -37,6 +37,7 @@ body { color: #000; box-shadow: none; } + .btn-primary { width: 100px; @@ -108,6 +109,7 @@ body { padding: 10px 20px; border-radius: 10px; display: flex; + justify-content: space-between; box-shadow: 0px 0px 10px rgba(66, 71, 76, 0.08); align-items: center; @@ -122,6 +124,7 @@ body { color: #ffffff; /* Active link color */ background-color: #282e26; border-radius: 20px; + padding: 10px 15px; font-weight: bold; /* Bold text for active link */ } .nav-list { @@ -142,7 +145,7 @@ body { } .nav-link { font-family: "Manrope"; - font-size: 18px !important; + font-size: 16px !important; color: #002300; text-decoration: none; @@ -494,6 +497,7 @@ body { } .search-container input { width: 100%; + color: #000; height: 50px; background: #f4f4f4; border-radius: 50px; @@ -503,7 +507,7 @@ body { box-sizing: border-box; } .search-container input::placeholder { - color: #ffffff; + color: #282E26; } .search-container input:focus { outline: none; @@ -789,7 +793,8 @@ h3 { .table-responsive th { - background-color: #f4f4f4; + background-color: #282e26; + color: white; } .table-responsives { border: 0.5px solid #f4f4f4; @@ -858,6 +863,7 @@ h5 { background-color: white; border-radius: 0.5rem; } + .modal-header, .modal-body, .modal-footer { From e6a93e14316d2c4f0438719aa26988b47a1af923 Mon Sep 17 00:00:00 2001 From: sonali Date: Mon, 23 Dec 2024 18:56:43 +0530 Subject: [PATCH 2/3] " new update" --- src/assets/Image/Department.png | Bin 0 -> 555 bytes src/assets/Image/employee.png | Bin 0 -> 657 bytes src/assets/Image/owner.png | Bin 0 -> 965 bytes src/assets/Image/store.png | Bin 0 -> 675 bytes src/assets/Image/user.png | Bin 0 -> 484 bytes .../AppPAges/Dashboard/Invoice/Invoice.css | 2 +- .../Pages/AppPAges/Expense/expense.js | 98 +-- .../Pages/AppPAges/Gas/GasTypeTable.js | 2 +- .../Pages/AppPAges/Gas/HouseChargeTable.js | 2 +- .../AppPAges/Lottery/LotteryInventoryTable.js | 2 +- .../AppPAges/Lottery/LotteryReportTable.js | 2 +- .../Pages/AppPAges/Lottery/LotteryTable.js | 2 +- .../AppPAges/Lottery/WeeklyInvoiceTable.js | 2 +- .../AppPAges/ManageSettings/DataTable.js | 10 +- .../AppPAges/ManageSettings/DataTables.js | 96 +-- .../ManageSettings/ManageUserTable.js | 69 +- .../AppPAges/ManageSettings/ManageUsers.js | 90 ++- .../AppPAges/ManageSettings/ReusableModal.js | 51 +- .../AppPAges/ManageSettings/SettingTable.js | 2 +- .../AppPAges/ManageSettings/Settings.css | 23 +- .../Pages/AppPAges/Payroll/Payroll.js | 610 +++++++++------- .../Pages/AppPAges/Payroll/PayrollTable.js | 119 ++-- .../Payroll/PayrollTableWithButton.js | 222 +++--- .../Pages/AppPAges/Purchase/purchase.js | 516 ++++++++++---- .../ReusableForm/AddDepartmentModal.js | 20 +- .../AppPAges/ReusableForm/AddExpenseModal.js | 24 +- .../AppPAges/ReusableForm/AddVendorModal.js | 28 +- src/components/common/Header.js | 663 ++++++++++-------- src/components/common/header.css | 1 + 29 files changed, 1622 insertions(+), 1034 deletions(-) create mode 100644 src/assets/Image/Department.png create mode 100644 src/assets/Image/employee.png create mode 100644 src/assets/Image/owner.png create mode 100644 src/assets/Image/store.png create mode 100644 src/assets/Image/user.png diff --git a/src/assets/Image/Department.png b/src/assets/Image/Department.png new file mode 100644 index 0000000000000000000000000000000000000000..6e866c958f7c675404508f5bc33156535338e7db GIT binary patch literal 555 zcmV+`0@VG9P) z_3mmShCF6B#t7y#vpaLn+&lL%19b6AAYEdfQRCj{%!ttVStzf+jGa0TWnjX4Hk8!UCKGG@xZzxslX_oY>UiX&G(@{ z0nxGIsvGJ%zKaYXyf1_$_;=8eTkJTCLSmf8^S%t{*j|^#9oZl)V;VjnnwV%};%y>A z)!gByv*T)zlvBT6H?@PQnswnV$Bp!(}^I+o+giJ3W+g*|V4dMTlr_U6GeIeuJp zzonmF!?2P>^zA|kqV;l|5eK@&*u4r${PgLdWQ3CPci6P#5$o@Z@{cY z)=eu~k6Z*9nnD-G5W_txxSA_clLfs{e|5iFC-$uF|w(WZ|)^fHv5 zwFER2WSAx6a>frjbfn44xYoi{s3#>3_1UD$q5eh0$ec1iksR2mo1_@!L#Qz=$9;W% zWL*F4Wc&?ktlCKSTuDaxD|reP)--)yYFs~Sd)KH;guPxt?Zw{e^0+=qj*9UlA#YJK&} z>>8+~S@&ood+!9(%nYyeT0Xuc#D?y1D|tsA>#`Fcp{B+x@(Aj?%VZ%LJpz?n@*{9z r>Wq1k_s|2V-y4}SR}kY|9XFi zN+@z;goQz7Q6y<5WzN%a#xZr?>3e26Iga-}=z}-+&VAoK-+kwvd)|3~2XsnPK|=bf z6JkG0N-W81FfR7X0g2U!NS+s4%9NOpA5p+}l~cCnpfm?jv{5NF00USiq&8`rso=ji zji`$?N!YKFVz0&j5}u3Mrv%twKwU17J3Z1fOGnfSi^L-oJqmLy$wy$dj-(Y%!db&W z2*DH5Q5{1o?7%62M+`#-bsS4iQ0;649$>*~({uD#M^~p{2n98y5Ll$+>4OW{!OPg) zjOrPJ^d22gE6k^Dhi6Eqj$z>H^aFU@W14-gW#|Y&M4nRjB8;KVhfvs{Wx)W0(zk2` z>38e~G}Iv<-FAR*`HW3};nt|u}7@K&m`&?MB4}sG#wr7X} z6gDeZWjv={Q^OTrNbQI_%@U?s3G@i}qI*>c#jL;3POr3t z)ttKt^p^1H=jkT1ZmY-==F=>M0Rpi0*|3A;&!?%VEp{PiSHKM88vcpZ_tSdfN%M4Bj;Gg^NG9*RhGwmq?g00000NkvXXu0mjf!Xv-5 literal 0 HcmV?d00001 diff --git a/src/assets/Image/store.png b/src/assets/Image/store.png new file mode 100644 index 0000000000000000000000000000000000000000..1f3bccabed45690254e854620572055cddc81ba4 GIT binary patch literal 675 zcmV;U0$lxxP)-TB@NZVdp8=E5ye}ga0?`U~0Tx*Wi8d^Hmq>eu@Je`^gyXf6>fmca* zTRyBMg`jK^D9c&` z@`mgqWD)|2iBPmvycPJ51x6D6lFb z3dcUYCr9M?yD+V#wW1(V#6NQQVthy)C*ganx`-aHhE{jqaYp9L+zyY>&w$aut;j2i zJj_eJGJO7xqt&GZywteP9i;3WZvo@gb%HyQqF^{3j zfq0dQDfnmp{{tB$*YIEQ6>W+K_aS;E^&KpqJiQXAS}kL+2>-}eNk=^R4bd&*n+HT! aD}Df<%~J=w84Cme0000 - {[ - { value: "cash", label: "Cash" }, - { value: "cheque", label: "Check" }, - { value: "bank", label: "Bank Card/ACH/EFT" } - ].map((method) => ( - - ))} - -)} +
+ {[ + { value: "cash", label: "Cash" }, + { value: "cheque", label: "Check" }, + { value: "bank", label: "Bank Card/ACH/EFT" } + ].map((method) => ( + + ))} +
+ )} {(formData.pay_method_status === "pay_later" || formData.pay_method_status === "credit_invoice") && ( -
+
- +
diff --git a/src/components/Pages/AppPAges/Gas/HouseChargeTable.js b/src/components/Pages/AppPAges/Gas/HouseChargeTable.js index 5d35efb..662a2ae 100644 --- a/src/components/Pages/AppPAges/Gas/HouseChargeTable.js +++ b/src/components/Pages/AppPAges/Gas/HouseChargeTable.js @@ -321,7 +321,7 @@ const HouseChargeTable = ({ - +
diff --git a/src/components/Pages/AppPAges/Lottery/LotteryInventoryTable.js b/src/components/Pages/AppPAges/Lottery/LotteryInventoryTable.js index 4cda55b..b68ab46 100644 --- a/src/components/Pages/AppPAges/Lottery/LotteryInventoryTable.js +++ b/src/components/Pages/AppPAges/Lottery/LotteryInventoryTable.js @@ -90,7 +90,7 @@ const LotteryInventoryTable = ({ return (
- +
{columns.map((col, index) => ( diff --git a/src/components/Pages/AppPAges/Lottery/LotteryReportTable.js b/src/components/Pages/AppPAges/Lottery/LotteryReportTable.js index 5b92997..3017878 100644 --- a/src/components/Pages/AppPAges/Lottery/LotteryReportTable.js +++ b/src/components/Pages/AppPAges/Lottery/LotteryReportTable.js @@ -194,7 +194,7 @@ const LotteryReportTable = ({
-
+
diff --git a/src/components/Pages/AppPAges/Lottery/LotteryTable.js b/src/components/Pages/AppPAges/Lottery/LotteryTable.js index 0643463..b255f50 100644 --- a/src/components/Pages/AppPAges/Lottery/LotteryTable.js +++ b/src/components/Pages/AppPAges/Lottery/LotteryTable.js @@ -190,7 +190,7 @@ const LotteryTable = ({ - +
{columns.map((col, index) => ( diff --git a/src/components/Pages/AppPAges/Lottery/WeeklyInvoiceTable.js b/src/components/Pages/AppPAges/Lottery/WeeklyInvoiceTable.js index 707a71e..9c87723 100644 --- a/src/components/Pages/AppPAges/Lottery/WeeklyInvoiceTable.js +++ b/src/components/Pages/AppPAges/Lottery/WeeklyInvoiceTable.js @@ -335,7 +335,7 @@ const WeeklyInvoiceTable = ({ -
+
diff --git a/src/components/Pages/AppPAges/ManageSettings/DataTable.js b/src/components/Pages/AppPAges/ManageSettings/DataTable.js index fc5169b..23053aa 100644 --- a/src/components/Pages/AppPAges/ManageSettings/DataTable.js +++ b/src/components/Pages/AppPAges/ManageSettings/DataTable.js @@ -84,7 +84,7 @@ const DataTable = ({ }; return (
- +
@@ -180,7 +180,7 @@ const DataTable = ({ {showFooter && ( )} diff --git a/src/components/Pages/AppPAges/ManageSettings/DataTables.js b/src/components/Pages/AppPAges/ManageSettings/DataTables.js index e1bb10e..5dc8db1 100644 --- a/src/components/Pages/AppPAges/ManageSettings/DataTables.js +++ b/src/components/Pages/AppPAges/ManageSettings/DataTables.js @@ -134,24 +134,24 @@ const PayrollTable = ({ color: "#fff", borderRadius: "10px", padding: "5px 20px", - textAlign:'center', - alignItems:'center' + textAlign: 'center', + alignItems: 'center' }, paid: { backgroundColor: "#198f51", color: "#fff", borderRadius: "10px", padding: "5px 20px", - textAlign:'center', - alignItems:'center' + textAlign: 'center', + alignItems: 'center' }, partially_paid: { backgroundColor: "#0c8ce9", color: "#fff", borderRadius: "10px", padding: "5px 20px", - textAlign:'center', - alignItems:'center' + textAlign: 'center', + alignItems: 'center' }, }; const paymentMethodStyles = { @@ -250,55 +250,55 @@ const PayrollTable = ({ */} -
-
-
Show
- +
Show
+ +
- - - +
+ {columns.map((col, index) => (
handleSort(col.field)}> diff --git a/src/components/Pages/AppPAges/ManageSettings/ManageUserTable.js b/src/components/Pages/AppPAges/ManageSettings/ManageUserTable.js index 43027b0..5443728 100644 --- a/src/components/Pages/AppPAges/ManageSettings/ManageUserTable.js +++ b/src/components/Pages/AppPAges/ManageSettings/ManageUserTable.js @@ -179,6 +179,7 @@ const ManageUserTable = ({
setSearchTerm(e.target.value)} @@ -276,26 +277,54 @@ const ManageUserTable = ({
)}
-
-

Show

- +
Show
+ +
+ - +
@@ -418,7 +447,7 @@ const ManageUserTable = ({ {showFooter && ( )} diff --git a/src/components/Pages/AppPAges/ManageSettings/ManageUsers.js b/src/components/Pages/AppPAges/ManageSettings/ManageUsers.js index e187558..acb5932 100644 --- a/src/components/Pages/AppPAges/ManageSettings/ManageUsers.js +++ b/src/components/Pages/AppPAges/ManageSettings/ManageUsers.js @@ -10,6 +10,10 @@ import { toast, ToastContainer } from "react-toastify"; import CustomSwitch from "./CustomSwitch"; import ManageUserTable from "./ManageUserTable"; import Swal from "sweetalert2"; +import userIcon from '../../../../assets/Image/user.png' +import storeIcon from '../../../../assets/Image/store.png' +import ownerIcon from '../../../../assets/Image/owner.png' + function ManageUsers() { @@ -387,29 +391,69 @@ function ManageUsers() { <>
-
-
Manage Users
-
- - - -
-
+
+
Manage Users
+
{/* Set up flex with gap */} + + + +
+
+ {title} - - - +
+ + + +
{children}
diff --git a/src/components/Pages/AppPAges/ManageSettings/SettingTable.js b/src/components/Pages/AppPAges/ManageSettings/SettingTable.js index 8cab041..196bdfa 100644 --- a/src/components/Pages/AppPAges/ManageSettings/SettingTable.js +++ b/src/components/Pages/AppPAges/ManageSettings/SettingTable.js @@ -312,7 +312,7 @@ const SettingTable = ({ - +
diff --git a/src/components/Pages/AppPAges/ManageSettings/Settings.css b/src/components/Pages/AppPAges/ManageSettings/Settings.css index 5e7170b..6f94b22 100644 --- a/src/components/Pages/AppPAges/ManageSettings/Settings.css +++ b/src/components/Pages/AppPAges/ManageSettings/Settings.css @@ -284,7 +284,7 @@ padding: 10px; width: 600px; height: 40px; - background-color: #f6f6f6; + background-color: #fff; border: 1px solid #f6f6f6; border-radius: 5px; } @@ -516,18 +516,18 @@ input[type="date"] { width: 100%; border: 1px solid #F4F4F4; border-collapse: collapse; - border-radius: 20px 20px 0 0; + /* border-radius: 20px 20px 0 0; */ overflow: hidden; } .table-header th, .table-body td { - border: 1px solid #F4F4F4; + /* border: 1px solid #F4F4F4; */ padding: 12px; text-align: left; padding-left: 20px; } .table-header th { - background-color: #f2f2f2; - color: #002300; + background-color: #282e26; + color: white; cursor: pointer; /* Added cursor for sortable columns */ } .table-body td { @@ -568,6 +568,7 @@ input[type="date"] { display: flex; justify-content: end; padding: 10px 0; + } .pagination .page-item { margin: 0 5px; @@ -576,20 +577,24 @@ input[type="date"] { padding: 10px; border: 1px solid #F4F4F4; background-color: #b6d7a8; - border-radius: 50%; + border-radius: 30px; color: #002300; text-decoration: none; display: flex; align-items: center; justify-content: center; - width: 36px; - height: 36px; + width: 30px; + height: 30px; + transition: background-color 0.3s, color 0.3s; } .pagination .page-link:hover { - background-color: #ffaf32; + background-color: red; } .pagination .page-item.active .page-link { + width: 30px; + height: 30px; + border-radius: 30px; background-color: #ffaf32; /* Yellow background */ color: #002300; border-color:#fbfbfbfb; diff --git a/src/components/Pages/AppPAges/Payroll/Payroll.js b/src/components/Pages/AppPAges/Payroll/Payroll.js index f02130d..3d9c2d4 100644 --- a/src/components/Pages/AppPAges/Payroll/Payroll.js +++ b/src/components/Pages/AppPAges/Payroll/Payroll.js @@ -7,6 +7,8 @@ import useApi from "../../../../utils/api-manager/Helper/useApi"; import { toast, ToastContainer } from "react-toastify"; import PayrollTableWithButton from "./PayrollTableWithButton"; import Swal from "sweetalert2"; +import employeeIcon from '../../../../assets/Image/employee.png' + export default function Payroll() { const { user } = useContext(AuthContext); @@ -112,7 +114,7 @@ export default function Payroll() { const handleChange = (e) => { const { name, value } = e.target; - + // Restrict non-numeric input for contact_no if (name === "contact_no") { const numericValue = value.replace(/[^0-9]/g, ""); // Allow only digits @@ -121,7 +123,7 @@ export default function Payroll() { setFormData((prevData) => ({ ...prevData, [name]: value })); } }; - + const handlePaymentChange = (e) => { const { name, value } = e.target; @@ -210,53 +212,53 @@ export default function Payroll() { const updatedFormData = { ...formData, store: storeId }; - try { - let response; + try { + let response; - // If there's an editing payroll ID, we want to PATCH the payroll employee data - if (editingPayrollId) { - response = await Patch("payrollEmployeeData", editingPayrollId, updatedFormData); + // If there's an editing payroll ID, we want to PATCH the payroll employee data + if (editingPayrollId) { + response = await Patch("payrollEmployeeData", editingPayrollId, updatedFormData); - if (response.status === 200) { - setPayrollData(prevData => - prevData.map(payroll => - payroll.id === editingPayrollId ? { ...payroll, ...updatedFormData } : payroll - ) - ); - toast.success("Payroll updated successfully!"); + if (response.status === 200) { + setPayrollData(prevData => + prevData.map(payroll => + payroll.id === editingPayrollId ? { ...payroll, ...updatedFormData } : payroll + ) + ); + toast.success("Payroll updated successfully!"); + } + } else { + // If there's no editingPayrollId, it's a new payroll record + response = await Post("payrollEmployeeData", updatedFormData); + + if (response.status === 201) { + setPayrollData(prevData => [...prevData, response.data]); + toast.success("Payroll added successfully!"); + } else if (response.data) { + // Extract specific error messages and display them + const errorMessages = Object.entries(response.data) + .map(([field, messages]) => `${messages.join(", ")}`) + .join("\n"); + toast.error(errorMessages || "An unknown error occurred."); + } else { + toast.error("Please Validate Fields"); + } + } + + closeModal(); // Close the modal after submitting the form + } catch (error) { + console.error("Error submitting form", error); + if (error.response?.data) { + // Handle API response errors + const errorMessages = Object.entries(error.response.data) + .map(([field, messages]) => `${field}: ${messages.join(", ")}`) + .join("\n"); + toast.error(errorMessages || "An unknown error occurred."); + } else { + // Handle generic errors + toast.error("Error submitting form: " + error.message); + } } - } else { - // If there's no editingPayrollId, it's a new payroll record - response = await Post("payrollEmployeeData", updatedFormData); - - if (response.status === 201) { - setPayrollData(prevData => [...prevData, response.data]); - toast.success("Payroll added successfully!"); - } else if (response.data) { - // Extract specific error messages and display them - const errorMessages = Object.entries(response.data) - .map(([field, messages]) => `${messages.join(", ")}`) - .join("\n"); - toast.error(errorMessages || "An unknown error occurred."); - } else { - toast.error("Please Validate Fields"); - } - } - - closeModal(); // Close the modal after submitting the form -} catch (error) { - console.error("Error submitting form", error); - if (error.response?.data) { - // Handle API response errors - const errorMessages = Object.entries(error.response.data) - .map(([field, messages]) => `${field}: ${messages.join(", ")}`) - .join("\n"); - toast.error(errorMessages || "An unknown error occurred."); - } else { - // Handle generic errors - toast.error("Error submitting form: " + error.message); - } -} } @@ -297,11 +299,11 @@ export default function Payroll() { bank: paymentData.payment_method === "cheque" ? paymentData.bank : "", bank_name: bankName, // Include bank_name in the payload cheque_no: - paymentData.payment_method === "cheque" - ? paymentData.cheque_no || "" - : editingPayrollId - ? paymentData.cheque_no // Preserve existing cheque_no if editing - : null, + paymentData.payment_method === "cheque" + ? paymentData.cheque_no || "" + : editingPayrollId + ? paymentData.cheque_no // Preserve existing cheque_no if editing + : null, note: paymentData.note, }; @@ -332,45 +334,45 @@ export default function Payroll() { const handleDelete = async (id, type) => { const result = await Swal.fire({ - title: "Are you sure?", - text: "You won't be able to revert this!", - icon: "warning", - showCancelButton: true, - confirmButtonColor: "#d33", - cancelButtonColor: "#3085d6", - confirmButtonText: "Yes, delete it!", + title: "Are you sure?", + text: "You won't be able to revert this!", + icon: "warning", + showCancelButton: true, + confirmButtonColor: "#d33", + cancelButtonColor: "#3085d6", + confirmButtonText: "Yes, delete it!", }); // Check if the user clicked the confirm button if (!result.isConfirmed) return; // Exit if the user cancels try { - if (type === "payroll") { - // Delete payroll record - await Delete(`payrollEmployeeData`, id); - // Update payroll data in the frontend - setPayrollData((prevPayrollData) => prevPayrollData.filter((p) => p.id !== id)); + if (type === "payroll") { + // Delete payroll record + await Delete(`payrollEmployeeData`, id); + // Update payroll data in the frontend + setPayrollData((prevPayrollData) => prevPayrollData.filter((p) => p.id !== id)); - // Fetch updated salary history data from the backend - const updatedSalaryHistory = await Get("payrollSalaryData"); - setSalaryHistory(updatedSalaryHistory); + // Fetch updated salary history data from the backend + const updatedSalaryHistory = await Get("payrollSalaryData"); + setSalaryHistory(updatedSalaryHistory); - toast.success("Payroll record deleted successfully!"); - } else if (type === "salaryHistory") { - // Delete salary history record - await Delete(`payrollSalaryData`, id); - // Update salary history data in the frontend - setSalaryHistory((prevSalaryHistory) => - prevSalaryHistory.filter((s) => s.id !== id) - ); + toast.success("Payroll record deleted successfully!"); + } else if (type === "salaryHistory") { + // Delete salary history record + await Delete(`payrollSalaryData`, id); + // Update salary history data in the frontend + setSalaryHistory((prevSalaryHistory) => + prevSalaryHistory.filter((s) => s.id !== id) + ); - toast.success("Salary history record deleted successfully!"); - } + toast.success("Salary history record deleted successfully!"); + } } catch (error) { - console.error("Error deleting record:", error); - toast.error("Error deleting record: " + (error.response?.data || error.message)); + console.error("Error deleting record:", error); + toast.error("Error deleting record: " + (error.response?.data || error.message)); } -}; + }; return ( @@ -378,9 +380,9 @@ export default function Payroll() {
-

Manage Payroll

+

Manage Employee

e.stopPropagation()} - style={{ width: modalType === 'payment' ? '800px' : '700px' }} + style={{ width: modalType === 'payment' ? '800px' : '700px', borderRadius: '40px' }} > -
-

- {modalType === 'new' && "Add Employee"} - {modalType === 'edit' && "Edit Employee"} - {modalType === 'payment' && `Process Payment for ${selectedPayroll?.full_name || ''}`} -

- +
+
+

+ {modalType === 'new' && 'Add Employee'} + {modalType === 'edit' && 'Edit Employee'} + {modalType === 'payment' && `Pay Salary For ${selectedPayroll?.full_name || ''}`} +

+
+ + +
+ { } {(modalType === 'new' || modalType === 'edit') && (
@@ -434,6 +467,12 @@ export default function Payroll() { name="full_name" value={formData.full_name} onChange={handleChange} + style={{ + backgroundColor: "#ffffff", + border: "none", // Remove all borders + borderBottom: "2px solid #ccc", // Set bottom border + borderRadius: "0px", // Remove border radius + }} required />
@@ -448,6 +487,12 @@ export default function Payroll() { onChange={handleChange} required maxLength={10} + style={{ + backgroundColor: "#ffffff", + border: "none", // Remove all borders + borderBottom: "2px solid #ccc", // Set bottom border + borderRadius: "0px", // Remove border radius + }} /> @@ -461,15 +506,21 @@ export default function Payroll() { name="email" value={formData.email} onChange={handleChange} + style={{ + backgroundColor: "#ffffff", + border: "none", // Remove all borders + borderBottom: "2px solid #ccc", // Set bottom border + borderRadius: "0px", // Remove border radius + }} required />
-
- -
@@ -478,166 +529,253 @@ export default function Payroll() { { } {modalType === 'payment' && ( -
-
- -
-
- $ -
- { - // Prevent negative and positive signs - if (e.key === "-" || e.key === "+") { - e.preventDefault(); - } - }} - required - onInput={(e) => { - let value = e.target.value; - - // Remove all characters except numbers and the decimal point - value = value.replace(/[^0-9.]/g, ''); - - // Ensure only one decimal point - if (value.indexOf('.') !== -1) { - const parts = value.split('.'); - value = parts[0] + '.' + parts[1].substring(0, 2); // Keep only two digits after the decimal - } - - // Update the value on the input element - e.target.value = value; - - // Call the onChange handler to update the state - handlePaymentChange(e); - }} - /> -
-
- - -
- - -
-
- - -
-
- - -
- {/* */} -
- - { - // Allow only numbers and a decimal point with two digits after it - e.target.value = e.target.value - - .replace(/[^0-9]/g, '') // Remove non-numeric characters - .slice(0, 3); // Limit input length (10 digits + 1 decimal + 2 decimal places) - }} - required - /> -
-
- - -
- {paymentData.payment_method === "cheque" && ( -
- - { + if (e.key === "-" || e.key === "+") { + e.preventDefault(); + } + }} + style={{ + backgroundColor: "#ffffff", + border: "none", + borderBottom: "2px solid #ccc", + borderRadius: "0px", + }} + required + onInput={(e) => { + let value = e.target.value; + value = value.replace(/[^0-9.]/g, ""); + if (value.indexOf(".") !== -1) { + const parts = value.split("."); + value = parts[0] + "." + parts[1].substring(0, 2); + } + e.target.value = value; + handlePaymentChange(e); + }} + /> +
+ + {/* Salary Unit Select */} +
+ - +
+
+ + + +
+ {/* Start Date Input */} +
+ + +
+ + {/* End Date Input */} +
+ + +
+
+ + + + + {/* */} +
+ {/* Total Hours Input */} +
+ { + // Allow only numbers and limit input to 3 digits + e.target.value = e.target.value.replace(/[^0-9]/g, '').slice(0, 3); + }} + style={{ + backgroundColor: "#ffffff", + border: "none", + borderBottom: "2px solid #ccc", + borderRadius: "0px", + }} required />
- )} -
- - + + {/* Payment Method Select */} +
+
+ + +
+
+ + +
+ + {paymentData.payment_method === "cheque" && ( +
+
+ + +
+ +
+ + +
+
+ + +
+
+ + + )} +
- -
diff --git a/src/components/Pages/AppPAges/Payroll/PayrollTable.js b/src/components/Pages/AppPAges/Payroll/PayrollTable.js index 1b92226..c5dd1d5 100644 --- a/src/components/Pages/AppPAges/Payroll/PayrollTable.js +++ b/src/components/Pages/AppPAges/Payroll/PayrollTable.js @@ -16,6 +16,7 @@ const DataTable = ({ direction: "ascending", }); const [rowsPerPage, setRowsPerPage] = useState(5); + const [searchTerm, setSearchTerm] = useState(""); // State for search term const totalPages = Math.ceil(data.length / rowsPerPage); @@ -32,7 +33,7 @@ const DataTable = ({ const getDisplayedData = () => { const startIndex = (currentPage - 1) * rowsPerPage; const endIndex = startIndex + rowsPerPage; - return data.slice(startIndex, endIndex); + return sortedData.slice(startIndex, endIndex); // Return sorted data }; // Sorting the data based on the selected column @@ -51,8 +52,16 @@ const DataTable = ({ return dataToSort; }; + // Search functionality + const filteredData = data.filter(item => + columns.some(col => { + const value = item[col.field] ? item[col.field].toString().toLowerCase() : ""; + return value.includes(searchTerm.toLowerCase()); + }) + ); + + const sortedData = sortData(filteredData); const displayedData = getDisplayedData(); - const sortedData = sortData(displayedData); // Pagination const handleNext = () => { @@ -90,7 +99,40 @@ const DataTable = ({ return (
- +
+ setSearchTerm(e.target.value)} + className="search-input" + /> + + + + +
+
{columns.map((col, index) => ( @@ -134,17 +176,19 @@ const DataTable = ({ {sortedData.length === 0 ? ( - ) : ( - sortedData.map((item, index) => ( + displayedData.map((item, index) => ( {columns.map((col, colIndex) => (
+ No data found
@@ -200,55 +244,18 @@ const DataTable = ({ )}
- {showFooter && ( - + +
)} ); diff --git a/src/components/Pages/AppPAges/Payroll/PayrollTableWithButton.js b/src/components/Pages/AppPAges/Payroll/PayrollTableWithButton.js index a50b701..798a4f1 100644 --- a/src/components/Pages/AppPAges/Payroll/PayrollTableWithButton.js +++ b/src/components/Pages/AppPAges/Payroll/PayrollTableWithButton.js @@ -154,18 +154,19 @@ const PayrollTableWithButton = ({ borderRadius: "4px", zIndex: "1", }; - // Calculate the total net sales from the data -// const totalNetSales = data.reduce((acc, item) => { -// const amount = Number(item.total_net_sales) || 0; // Make sure to handle non-numeric values -// return acc + amount; -// }, 0).toFixed(2); // + // Calculate the total net sales from the data + // const totalNetSales = data.reduce((acc, item) => { + // const amount = Number(item.total_net_sales) || 0; // Make sure to handle non-numeric values + // return acc + amount; + // }, 0).toFixed(2); // return (
-
-
+
+
setSearchTerm(e.target.value)} placeholder="Search" @@ -237,7 +238,7 @@ const PayrollTableWithButton = ({ Export To Excel )} - {showFilter && ( + {showFilter && (
-
-

Show

- +
Show
+ +
+
- +
- {sortedDisplayedData.length === 0 ? ( - - - - ) : ( - sortedDisplayedData.map((item) => ( - - - {columns.map((col, colIndex) => ( - + + + ) : ( + sortedDisplayedData.map((item) => ( + + - ))} - {showAction && ( - + ))} + {showAction && ( + - )} + + + + + + + )} - - )) - )} - + + )) + )} +
@@ -324,78 +353,80 @@ const PayrollTableWithButton = ({
- No data found -
- {(currentPage - 1) * rowsPerPage + sortedDisplayedData.indexOf(item) + 1} - - {col.field === "status" ? ( -
{item[col.field]}
- ) : col.field === "pay_salary" ? ( - - ) : ( - item[col.field] - )} + {sortedDisplayedData.length === 0 ? ( +
+ No data found +
+ {(currentPage - 1) * rowsPerPage + sortedDisplayedData.indexOf(item) + 1} - + {col.field === "status" ? ( +
{item[col.field]}
+ ) : col.field === "pay_salary" ? ( + + ) : ( + item[col.field] + )} +
+ - -
{showFooter && ( @@ -423,9 +454,8 @@ const PayrollTableWithButton = ({ {renderPagination()}
  •   { const value = e.target.value; + setSelectedPaymentMethod(value); // Update selected payment method state setShowCheckFields(value === "cheque"); setShowBankFields(value === "bank"); @@ -514,8 +518,8 @@ export default function Purchase() { // Editing an existing invoice const originalInvoice = invoices.find((invoice) => invoice.id === editingInvoiceId); if (!originalInvoice) { - console.error("Invoice not found for editingInvoiceId:", editingInvoiceId); - return; + console.error("Invoice not found for editingInvoiceId:", editingInvoiceId); + return; } // Determine the new status based on payment method and remaining amount @@ -523,11 +527,11 @@ export default function Purchase() { let newStatus = originalInvoice.status; // Start with the original status if (formData.pay_method_status === "pay_now") { - newStatus = "paid"; // Always "paid" if paid now + newStatus = "paid"; // Always "paid" if paid now } else if (formData.pay_method_status === "pay_later") { - newStatus = "unpaid"; // Ensure unpaid if paying later + newStatus = "unpaid"; // Ensure unpaid if paying later } else if (newRemainingAmount < originalInvoice.amount) { - newStatus = "partially_paid"; // Adjust if partially paid + newStatus = "partially_paid"; // Adjust if partially paid } @@ -619,12 +623,141 @@ export default function Purchase() {
    -
    -

    Purchase

    - + + + + + +
    + {/* Invoice due this month */} +
    +

    + $500 +

    +

    + Invoice due this month +

    +
    + + {/* Last 7 days sale */} +
    +

    + $1900 +

    +

    + Last 7 days sale +

    +
    + + {/* Expense this month */} +
    +

    + $0.00 +

    +

    + Expense this month +

    +
    +
    + +
    {/* Table Start */} @@ -695,8 +828,10 @@ export default function Purchase() { { + // Allow only numbers and a decimal point with two digits after it + e.target.value = e.target.value + .replace(/[^0-9.]/g, '') // Remove non-numeric characters except the decimal point + .replace(/^(\d*\.?\d{0,2}).*/g, '$1') // Allow only two decimal places + .slice(0, 12); // Limit input length (10 digits + 1 decimal + 2 decimal places) + }} + /> +
    + +
    +
    - {" "} - Pay Later - - - -
    - {showPaymentOptions && ( -
    + +
    + + {showPaymentOptions && ( +
    +
    handleSpecificPaymentMethodChange({ target: { value: "cash" } })} + style={{ + padding: '5px 10px', + cursor: "pointer", + borderRadius: "20px", + backgroundColor: selectedPaymentMethod === "cash" ? "#4a5546" : "transparent", // Change background based on selection + color: selectedPaymentMethod === "cash" ? "white" : "black", // Change text color based on selection + textAlign: "center", + }} + > + Cash +
    +
    handleSpecificPaymentMethodChange({ target: { value: "cheque" } })} + style={{ + padding: '5px 10px', + cursor: "pointer", + borderRadius: "20px", + backgroundColor: selectedPaymentMethod === "cheque" ? "#4a5546" : "transparent", + color: selectedPaymentMethod === "cheque" ? "white" : "black", + textAlign: "center", + }} + > + Check +
    +
    handleSpecificPaymentMethodChange({ target: { value: "bank" } })} + style={{ + padding: '5px 10px', + cursor: "pointer", + borderRadius: "20px", + backgroundColor: selectedPaymentMethod === "bank" ? "#4a5546" : "transparent", + color: selectedPaymentMethod === "bank" ? "white" : "black", + textAlign: "center", + }} + > + Bank Card/ACH/EFT +
    +
    )} + + {showAdditionalFields && ( -
    +
    @@ -1056,19 +1313,19 @@ export default function Purchase() {
    - USD - + */}
    )} -
    -
    -
    - - USD - -
    - { - // Allow only numbers and a decimal point with two digits after it - e.target.value = e.target.value - .replace(/[^0-9.]/g, '') // Remove non-numeric characters except the decimal point - .replace(/^(\d*\.?\d{0,2}).*/g, '$1') // Allow only two decimal places - .slice(0, 12); // Limit input length (10 digits + 1 decimal + 2 decimal places) - }} - /> -
    -
    @@ -1146,13 +1354,15 @@ export default function Purchase() { type="button" className="btn btn-secondary-outline" onClick={toggleModal} + style={{ border: " 1px solid #282e26", borderRadius: '20px' }} > Close diff --git a/src/components/Pages/AppPAges/ReusableForm/AddDepartmentModal.js b/src/components/Pages/AppPAges/ReusableForm/AddDepartmentModal.js index 1767fe9..98b9753 100644 --- a/src/components/Pages/AppPAges/ReusableForm/AddDepartmentModal.js +++ b/src/components/Pages/AppPAges/ReusableForm/AddDepartmentModal.js @@ -37,23 +37,33 @@ const AddDepartmentModal = ({ show, handleClose, onDepartmentAdded }) => { }; return ( - +
    -
    +
    setDepartmentName(e.target.value)} - style={{ width: "483px", marginRight: "10px" }} + style={{ width: "483px", border: "none", // Remove all borders + borderBottom: "2px solid #ccc", // Set bottom border + marginBottom: "20px", + borderRadius: "0px", // Remove border radius + }} required /> +
    +
    +
    diff --git a/src/components/Pages/AppPAges/ReusableForm/AddExpenseModal.js b/src/components/Pages/AppPAges/ReusableForm/AddExpenseModal.js index 1fe4b84..c5a0e60 100644 --- a/src/components/Pages/AppPAges/ReusableForm/AddExpenseModal.js +++ b/src/components/Pages/AppPAges/ReusableForm/AddExpenseModal.js @@ -37,23 +37,35 @@ const AddExpenseTypeModal = ({ show, handleClose, onExpenseTypeAdded }) => { }; return ( - +
    -
    +
    setExpenseType(e.target.value)} - style={{ width: "483px", marginRight: "10px" }} + style={{ + width: "483px", + border: "none", // Remove all borders + borderBottom: "2px solid #ccc", // Set bottom border + marginBottom: "20px", + borderRadius: "0px", // Remove border radius + }} required /> +
    +
    @@ -170,10 +184,10 @@ const AddVendorModal = ({ show, handleClose, reloadData }) => { style={{ marginLeft: "690px", padding: "4px 8px", - backgroundColor: "#4545db", + backgroundColor: "#282e26", color: "white", border: "none", - borderRadius: "40px", + borderRadius: "20px", cursor: "pointer", width: "124px", height: "42px", diff --git a/src/components/common/Header.js b/src/components/common/Header.js index 940456b..00fdc65 100644 --- a/src/components/common/Header.js +++ b/src/components/common/Header.js @@ -34,9 +34,14 @@ const Header = () => { const settingsRef = useRef(null); const lotteryRef = useRef(null); const gasRef = useRef(null); - const [selectedNav, setSelectedNav] = useState("/"); + // const [selectedNav, setSelectedNav] = useState("/"); const { Get, getAPI, Post } = useApi(); + + const [parentLabel, setParentLabel] = useState("Expense"); // Parent label + const [selectedChild, setSelectedChild] = useState(""); // Selected child label + const [selectedNav, setSelectedNav] = useState("Expense"); + const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const toggleMobileMenu = () => { setIsMobileMenuOpen(!isMobileMenuOpen); @@ -59,6 +64,18 @@ const Header = () => { logOutUser(); }; + + const handleChildSelection = (childLabel) => { + setSelectedChild(childLabel); // Update the selected child label + setExpenseDropdownOpen(false); // Close the dropdown + }; + const toggleDropdown = () => { + setExpenseDropdownOpen(!expenseDropdownOpen); + if (expenseDropdownOpen) { + setSelectedChild(""); // Clear selected child if closing + } + }; + const handleStoreManageClick = async () => { setDropdownVisible(!isDropdownVisible); @@ -141,6 +158,8 @@ const Header = () => { setLotteryDropdownOpen(false); setGasDropdownOpen(false); setDropdownVisible(false); + setSelectedChild(""); + }; useEffect(() => { @@ -151,43 +170,42 @@ const Header = () => { }, []); return (
    -
    - Logo -
    +
    + Logo +
    -
    - User Avatar - {/* Display role_name here */} -
    - {userRole && {userRole}} -
    - {/* Settings Icon Button */} - +
    + User Avatar -
  • - - Profile - -
  • - {(userRole === "store owner" || userRole === "store manager") && ( -
  • - { - e.preventDefault(); - handleStoreManageClick(); - }} - > - Switch Store - -
  • - )} - {isDropdownVisible && ( - -
    + {/* Optional: Add an icon here */} + + + {settingsDropOpen && ( + + )} +
    +
    diff --git a/src/components/common/header.css b/src/components/common/header.css index f14e3d9..9cef3ae 100644 --- a/src/components/common/header.css +++ b/src/components/common/header.css @@ -49,6 +49,7 @@ .navbar-nav { flex-direction: column; + } .nav-menu-drop { From b139bcf40c5a0e91be228d6e4599d769fb0c5307 Mon Sep 17 00:00:00 2001 From: sonali Date: Tue, 24 Dec 2024 18:33:49 +0530 Subject: [PATCH 3/3] " ui change " --- public/index.html | 2 +- src/assets/css/App.css | 5 +- .../AppPAges/Dashboard/Invoice/AddInvoice.js | 6 +- .../AppPAges/Dashboard/Invoice/BankDeposit.js | 9 +- .../AppPAges/Dashboard/Invoice/Invoice.css | 11 +- .../Dashboard/Invoice/InvoiceTable.js | 38 +- .../AppPAges/Dashboard/Invoice/PayInvoice.js | 369 +++++++++--------- .../Dashboard/Invoice/PayInvoice_Table.js | 36 +- .../Pages/AppPAges/Expense/expense.js | 2 +- .../AppPAges/ManageSettings/DataTables.js | 80 ++-- .../ManageSettings/ManageDepartments.js | 23 +- .../ManageSettings/ManageUserTable.js | 57 ++- .../AppPAges/ManageSettings/ManageUsers.js | 258 +++++++----- .../AppPAges/ManageSettings/Settings.css | 64 ++- .../ManageSettings/StoreInformation.js | 4 +- .../Pages/AppPAges/Payroll/Payroll.js | 182 ++++----- .../Pages/AppPAges/Purchase/purchase.js | 8 +- src/components/common/header.css | 2 + 18 files changed, 688 insertions(+), 468 deletions(-) diff --git a/public/index.html b/public/index.html index b7751db..110113c 100644 --- a/public/index.html +++ b/public/index.html @@ -29,7 +29,7 @@