diff --git a/firm/src/App.js b/firm/src/App.js index 6fd3707..92f4a53 100644 --- a/firm/src/App.js +++ b/firm/src/App.js @@ -47,6 +47,7 @@ const App = () => { )}
+ : } /> : } /> : } /> : } /> diff --git a/firm/src/components/DatePicker.js b/firm/src/components/DatePicker.js new file mode 100644 index 0000000..55f000b --- /dev/null +++ b/firm/src/components/DatePicker.js @@ -0,0 +1,32 @@ +const DatePicker = ({ value, onChange, name, className, minDate, maxDate }) => { + const handleChange = (e) => { + const newValue = e.target.value; + const newDate = new Date(newValue); + + if (isNaN(newDate.getTime())) { + //alert('Podano niepoprawną datę'); + return; + } + + onChange(e); + }; + + const getCurrentDate = () => { + const now = new Date(); + const offset = now.getTimezoneOffset() * 60000; + const localISOTime = new Date(now.getTime() - offset).toISOString().slice(0, 16); + return localISOTime; + }; + + return ( + + ); + }; + +export default DatePicker; \ No newline at end of file diff --git a/firm/src/components/DodawanieTransakcji.js b/firm/src/components/DodawanieTransakcji.js index 4c30d5c..c7b1176 100644 --- a/firm/src/components/DodawanieTransakcji.js +++ b/firm/src/components/DodawanieTransakcji.js @@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react'; import axios from 'axios'; import { useNavigate } from 'react-router-dom'; import Select from 'react-select'; +import {ReactComponent as MinusIcon} from "../icons/minus-icon.svg" +import DatePicker from './DatePicker'; const DodawanieTransakcji = () => { const [error, setError] = useState(null); @@ -10,7 +12,7 @@ const DodawanieTransakcji = () => { date: '', employeeId: '', paymentType: '', - discount: '', + discount: 0, description: '', transactionProducts: [ { @@ -62,6 +64,7 @@ const DodawanieTransakcji = () => { const handleInputChange = (event) => { const { name, value } = event.target; setNewTransaction({ ...newTransaction, [name]: value }); + console.log(`po: ${name}, ${value}`) }; const handleCancel = () => { navigate('/transakcje'); @@ -158,90 +161,157 @@ const DodawanieTransakcji = () => { return (

Dodaj nową transakcję

- + {error &&

{error}

} - - +
+ + +
+ +
+ + +
+ + +
+ + {/* - - - - {isLoading ? ( -
Ładowanie produktów...
- ) : ( - <> - {newTransaction.transactionProducts.map((product, index) => ( -
- { - const updatedTransactionProducts = [...newTransaction.transactionProducts]; - updatedTransactionProducts[index].quantity = e.target.value; - setNewTransaction({ ...newTransaction, transactionProducts: updatedTransactionProducts }); - }} - placeholder="Ilość" - className="block w-full mb-2 px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500" - /> - -
- ))} - - )} - - - - */} + +
+ ))} + + )} + + + + {/* - - - - */} +
+
+ +
+ + + +
+
+
+ +
+ +
+
+ + { placeholder="Opis" className="block w-full mb-4 px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500" /> +
+
@@ -103,14 +106,14 @@ const ListaTransakcji = ({ onAdd}) => { Produkt Ilość Kwota - Sposób płatności - Nr. Pracownika + Metoda płatności + Nr pracownika Akcje {transactions.map(transaction => ( - + {transaction.id} {formatDate(transaction.date)} @@ -127,20 +130,22 @@ const ListaTransakcji = ({ onAdd}) => { {transaction.paymentType} {transaction.employeeId} +
+
))} diff --git a/firm/src/components/NavBar.js b/firm/src/components/NavBar.js index a602317..e8a31cf 100644 --- a/firm/src/components/NavBar.js +++ b/firm/src/components/NavBar.js @@ -1,6 +1,5 @@ import React, { useState, useEffect, useRef } from 'react'; import { Link, useNavigate } from 'react-router-dom'; -import lupaIcon from "../icons/lupa.jpg"; import profilIcon from "../icons/profil.png"; import axios from 'axios'; @@ -62,15 +61,6 @@ const Navbar = ({ setToken }) => {
FIRMTRACKER
-
- -
- Lupa -
-
\ No newline at end of file diff --git a/firm/src/icons/calendar.svg b/firm/src/icons/calendar.svg new file mode 100644 index 0000000..593b173 --- /dev/null +++ b/firm/src/icons/calendar.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/firm/src/icons/delete.svg b/firm/src/icons/delete.svg new file mode 100644 index 0000000..9ddea3d --- /dev/null +++ b/firm/src/icons/delete.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/firm/src/icons/edit.svg b/firm/src/icons/edit.svg new file mode 100644 index 0000000..9e718ea --- /dev/null +++ b/firm/src/icons/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/firm/src/icons/minus-icon.svg b/firm/src/icons/minus-icon.svg new file mode 100644 index 0000000..93729d9 --- /dev/null +++ b/firm/src/icons/minus-icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/firm/src/icons/transaction.svg b/firm/src/icons/transaction.svg new file mode 100644 index 0000000..797ec98 --- /dev/null +++ b/firm/src/icons/transaction.svg @@ -0,0 +1 @@ + \ No newline at end of file