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) => (
-
-
+ {/*
-
-
-
- */}
+
+
+
+ {
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"
/>
+
+