From e1ba0c5c243bce4178a683ecc0ccca0fcf31f826 Mon Sep 17 00:00:00 2001 From: Kamil Date: Mon, 30 Dec 2024 19:42:21 +0100 Subject: [PATCH 1/4] =?UTF-8?q?ma=C5=82e=20poprawki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firm/src/components/EdycjaTransakcji.js | 2 +- firm/src/components/ListaTransakcji.js | 3 ++- firm/src/components/NavBar.js | 10 ---------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/firm/src/components/EdycjaTransakcji.js b/firm/src/components/EdycjaTransakcji.js index eca8273..8ed9939 100644 --- a/firm/src/components/EdycjaTransakcji.js +++ b/firm/src/components/EdycjaTransakcji.js @@ -91,7 +91,7 @@ const EdycjaTransakcji = () => { }; const handleCancel = () => { - navigate('/transkacje'); + navigate('/transakcje'); } const handleInputChange = (event) => { diff --git a/firm/src/components/ListaTransakcji.js b/firm/src/components/ListaTransakcji.js index ffdd1db..2b49635 100644 --- a/firm/src/components/ListaTransakcji.js +++ b/firm/src/components/ListaTransakcji.js @@ -4,6 +4,7 @@ import editIcon from '../icons/edit.png'; import koszIcon from '../icons/kosz.png'; import { useNavigate } from 'react-router-dom'; + const ListaTransakcji = ({ onAdd}) => { const [transactions, setTransactions] = useState([]); const [deleteTransactionId, setDeleteTransactionId] = useState(null); @@ -104,7 +105,7 @@ const ListaTransakcji = ({ onAdd}) => { Ilość Kwota Sposób płatności - Nr. Pracownika + Nr pracownika Akcje 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 -
-
Date: Mon, 30 Dec 2024 19:45:56 +0100 Subject: [PATCH 2/4] date picker i zmiany wizualne tworzenia transakcji --- firm/src/components/DatePicker.js | 32 ++++ firm/src/components/DodawanieTransakcji.js | 208 ++++++++++++++------- 2 files changed, 172 insertions(+), 68 deletions(-) create mode 100644 firm/src/components/DatePicker.js 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" /> +
+
@@ -104,14 +106,14 @@ const ListaTransakcji = ({ onAdd}) => { Produkt Ilość Kwota - Sposób płatności + Metoda płatności Nr pracownika Akcje {transactions.map(transaction => ( - + {transaction.id} {formatDate(transaction.date)} @@ -128,20 +130,22 @@ const ListaTransakcji = ({ onAdd}) => { {transaction.paymentType} {transaction.employeeId} +
+
))} -- 2.20.1 From 8885e6cc0cd48a9a21f82a82fd28942892a2a21c Mon Sep 17 00:00:00 2001 From: Kamil Date: Mon, 30 Dec 2024 20:57:46 +0100 Subject: [PATCH 4/4] ikony part 1 --- firm/src/icons/account.svg | 1 + firm/src/icons/calendar.svg | 1 + firm/src/icons/delete.svg | 1 + firm/src/icons/edit.svg | 1 + firm/src/icons/minus-icon.svg | 1 + firm/src/icons/transaction.svg | 1 + 6 files changed, 6 insertions(+) create mode 100644 firm/src/icons/account.svg create mode 100644 firm/src/icons/calendar.svg create mode 100644 firm/src/icons/delete.svg create mode 100644 firm/src/icons/edit.svg create mode 100644 firm/src/icons/minus-icon.svg create mode 100644 firm/src/icons/transaction.svg diff --git a/firm/src/icons/account.svg b/firm/src/icons/account.svg new file mode 100644 index 0000000..782885d --- /dev/null +++ b/firm/src/icons/account.svg @@ -0,0 +1 @@ + \ 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 -- 2.20.1