drobnostki
This commit is contained in:
parent
a25a3d4011
commit
f7b4919212
@ -47,9 +47,9 @@ const App = () => {
|
||||
)}
|
||||
<div className="w-3/4">
|
||||
<Routes>
|
||||
<Route path="/*" element={token ? <Navigate to="/transakcje" /> : <Navigate to="/login" />} />
|
||||
<Route path="/" element={token ? <Navigate to="/transakcje" /> : <Navigate to="/login" />} />
|
||||
<Route path="/login" element={token ? <Navigate to="/transakcje" /> : <Login setToken={setToken} />} />
|
||||
<Route path="/*" element={token ? <Navigate to="/harmonogram" /> : <Navigate to="/login" />} />
|
||||
<Route path="/" element={token ? <Navigate to="/harmonogram" /> : <Navigate to="/login" />} />
|
||||
<Route path="/login" element={token ? <Navigate to="/harmonogram" /> : <Login setToken={setToken} />} />
|
||||
<Route path="/transakcje" element={token ? <ZarzadzanieTransakcjami /> : <Navigate to="/login" />} />
|
||||
<Route path="/transakcje/dodaj" element={token ? <DodawanieTransakcji /> : <Navigate to="/login" />} />
|
||||
<Route path="/transakcje/edytuj/:id" element={token ? <EdycjaTransakcji /> : <Navigate to="/login" />} />
|
||||
|
@ -8,7 +8,12 @@ const DatePicker = ({ value, onChange, name, className, minDate, maxDate }) => {
|
||||
return;
|
||||
}
|
||||
|
||||
onChange(e);
|
||||
onChange({
|
||||
target: {
|
||||
name: name,
|
||||
value: newValue,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const getCurrentDate = () => {
|
||||
|
@ -45,6 +45,8 @@ const DodawanieTransakcji = () => {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
const response = await axios.get('https://localhost:7039/api/Products', config);
|
||||
const productOptions = response.data.map(product => ({
|
||||
value: product.id,
|
||||
@ -280,13 +282,15 @@ const DodawanieTransakcji = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="">
|
||||
<label className="block mb-2 text-gray-700 font-medium">Rabat</label>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Rabat (%)</label>
|
||||
<input
|
||||
type="number"
|
||||
name="discount"
|
||||
value={newTransaction.discount}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Rabat"
|
||||
min="0"
|
||||
max="100"
|
||||
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"
|
||||
/></div>
|
||||
|
||||
|
@ -316,13 +316,15 @@ const EdycjaTransakcji = () => {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Rabat</label>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Rabat (%)</label>
|
||||
<input
|
||||
type="number"
|
||||
name="discount"
|
||||
value={transaction.discount}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Rabat"
|
||||
min="0"
|
||||
max="100"
|
||||
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"
|
||||
/>
|
||||
</div>
|
||||
|
@ -8,6 +8,7 @@ const ListaProduktow = ({ onAdd }) => {
|
||||
const [products, setProducts] = useState([]);
|
||||
const [deleteProductId, setDeleteProductId] = useState(null);
|
||||
const [showModal, setShowModal] = useState(false);
|
||||
const [deleteError, setDeleteError] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const fetchProducts = async () => {
|
||||
@ -18,6 +19,7 @@ const ListaProduktow = ({ onAdd }) => {
|
||||
});
|
||||
setProducts(response.data);
|
||||
} catch (error) {
|
||||
setDeleteError(true);
|
||||
console.error('Błąd podczas pobierania produktów:', error);
|
||||
}
|
||||
};
|
||||
@ -51,6 +53,8 @@ const ListaProduktow = ({ onAdd }) => {
|
||||
setShowModal(false);
|
||||
setDeleteProductId(null);
|
||||
} catch (error) {
|
||||
setShowModal(false);
|
||||
setDeleteError(true);
|
||||
console.error('Błąd podczas usuwania produktu:', error);
|
||||
}
|
||||
};
|
||||
@ -62,9 +66,9 @@ const ListaProduktow = ({ onAdd }) => {
|
||||
return (
|
||||
<div>
|
||||
<div className="flex items-center justify-between py-6 px-8 bg-gradient-to-r from-blue-500 to-teal-500 rounded-xl shadow-md mb-6">
|
||||
<h1 className="text-white text-4xl font-semibold">Katalog Produktów oraz usług</h1>
|
||||
<h1 className="text-white text-4xl font-semibold">Katalog produktów oraz usług</h1>
|
||||
<button onClick={onAdd} className="bg-gradient-to-r from-green-500 to-green-700 text-white py-2 px-4 rounded-lg hover:from-green-600 hover:to-green-800 transition">
|
||||
Dodaj Produkt
|
||||
Dodaj produkt
|
||||
</button>
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
@ -89,6 +93,7 @@ const ListaProduktow = ({ onAdd }) => {
|
||||
<td className="p-3 text-center">
|
||||
{product.type === 0 ? "" : product.availability}
|
||||
</td>
|
||||
<td className="p-3 flex justify-center space-x-2">
|
||||
<div className="flex justify-center items-center opacity-0 group-hover:opacity-100 transition-opacity duration-200">
|
||||
<button
|
||||
onClick={() => handleEditProduct(product.id)}
|
||||
@ -103,6 +108,7 @@ const ListaProduktow = ({ onAdd }) => {
|
||||
<KoszIcon className = "w-5 h-5"/>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@ -131,6 +137,20 @@ const ListaProduktow = ({ onAdd }) => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{deleteError && (
|
||||
<div className="fixed inset-0 bg-gray-500 bg-opacity-50 flex justify-center items-center z-50">
|
||||
<div className="bg-white p-6 rounded-md shadow-lg w-96">
|
||||
<h2 className="text-lg font-bold mb-4">Usuwanie produktu nie powiodło się.</h2>
|
||||
{/*<p>Tu będzie komunikat z api</p>*/}
|
||||
<button
|
||||
onClick={() => setDeleteError(false)}
|
||||
className="bg-gray-500 text-white py-2 px-4 rounded"
|
||||
>
|
||||
Wróć
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -91,7 +91,7 @@ const ListaTransakcji = ({ onAdd}) => {
|
||||
<div className="flex items-center justify-between py-6 px-8 bg-gradient-to-r from-blue-500 to-teal-500 rounded-xl shadow-md mb-6">
|
||||
<h1 className="text-white text-4xl font-semibold">Lista transakcji</h1>
|
||||
<button onClick={onAdd} className="bg-gradient-to-r from-green-500 to-green-700 text-white py-2 px-4 rounded-lg hover:from-green-600 hover:to-green-800 transition">
|
||||
Dodaj Transakcję
|
||||
Dodaj transakcję
|
||||
</button>
|
||||
</div>
|
||||
<div className="w-8/10 mx-auto mt-2">
|
||||
@ -101,8 +101,7 @@ const ListaTransakcji = ({ onAdd}) => {
|
||||
<tr>
|
||||
<th className="p-3 text-left">ID</th>
|
||||
<th className="p-3 text-left">Data</th>
|
||||
<th className="p-3 text-left">Produkt</th>
|
||||
<th className="p-3 text-left">Ilość</th>
|
||||
<th className="p-3 text-left">Produkty</th>
|
||||
<th className="p-3 text-left">Kwota</th>
|
||||
<th className="p-3 text-left">Metoda płatności</th>
|
||||
<th className="p-3 text-center">Nr pracownika</th>
|
||||
@ -114,16 +113,9 @@ const ListaTransakcji = ({ onAdd}) => {
|
||||
<tr key={transaction.id} className="group hover:bg-gray-100 transition-colors">
|
||||
<td className="p-3">{transaction.id}</td>
|
||||
<td className="p-3">{formatDate(transaction.date)}</td>
|
||||
<td className="p-3">
|
||||
{transaction.transactionProducts.map(product => (
|
||||
<div key={product.id}>{product.product.name}</div>
|
||||
))}
|
||||
</td>
|
||||
<td className="p-3">
|
||||
{transaction.transactionProducts.map(product => (
|
||||
<div key={product.id}>{product.quantity}</div>
|
||||
))}
|
||||
</td>
|
||||
<td className="p-3 truncate max-w-xs" title={transaction.transactionProducts.map(product => product.product.name).join(', ')}>
|
||||
{transaction.transactionProducts.map(product => product.product.name).join(', ')}
|
||||
</td>
|
||||
<td className="p-3">{formatPrice(transaction.totalPrice)}</td>
|
||||
<td className="p-3">{transaction.paymentType}</td>
|
||||
<td className="p-3 text-center">{transaction.employeeId}</td>
|
||||
|
@ -23,7 +23,7 @@ const Login = ({ setToken }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex justify-center items-center h-screen">
|
||||
<div className="flex justify-center items-center h-screen w-screen">
|
||||
<form onSubmit={handleLogin} className="p-4 bg-white shadow-md rounded">
|
||||
<h2 className="text-2xl mb-4 text-center">Logowanie</h2>
|
||||
{error && <p className="text-red-500">{error}</p>}
|
||||
|
@ -30,7 +30,7 @@ const PanelAdministratora = () => {
|
||||
}
|
||||
|
||||
try {
|
||||
await axios.post('https://localhost:7039/api/Workday/user/absence/add', {
|
||||
await axios.post('https://localhost:7039/api/Workday/absence/add', {
|
||||
userEmail: selectedEmail,
|
||||
absenceType: absenceType,
|
||||
startTime: startDate,
|
||||
|
@ -13,36 +13,36 @@ const Sidebar = ({ userRole }) => {
|
||||
<ul>
|
||||
{userRole !== 'User' && (
|
||||
<>
|
||||
<Link to="/panel" className="text-black px-10 py-2 block font-customFont text-center w-max">
|
||||
<Link to="/panel" className="text-black px-10 py-2 block font-customFont text-center w-full hover:bg-gray-300 transition duration-100">
|
||||
<li className='flex items-center'>
|
||||
<img src={adminIcon} alt="Obrazek 1" className="w-7 h-7 mr-2" />
|
||||
Panel Administratora
|
||||
Panel administratora
|
||||
</li></Link>
|
||||
</>
|
||||
)}
|
||||
<Link to="/produkty" className="text-black px-10 py-2 block font-customFont text-center w-max">
|
||||
<Link to="/produkty" className="text-black px-10 py-2 block font-customFont text-center w-full hover:bg-gray-300 transition duration-100 ">
|
||||
<li className='flex items-center'>
|
||||
<img src={produktIcon} alt="Obrazek 1" className="w-7 h-7 mr-2" />
|
||||
Produkty
|
||||
</li></Link>
|
||||
<Link to="/transakcje" className="text-black px-10 py-2 block font-customFont text-center w-max">
|
||||
<Link to="/transakcje" className="text-black px-10 py-2 block font-customFont text-center w-full hover:bg-gray-300 transition duration-100 ">
|
||||
<li className='flex items-center'>
|
||||
<img src={transakcjeIcon} alt="Obrazek 1" className="w-7 h-7 mr-2" />
|
||||
Transakcje
|
||||
</li></Link>
|
||||
<Link to="/harmonogram" className="text-black px-10 py-2 block font-customFont text-center w-max flex-item-center">
|
||||
<Link to="/harmonogram" className="text-black px-10 py-2 block font-customFont text-center w-full flex-item-center hover:bg-gray-300 transition duration-100 ">
|
||||
<li className='flex items-center'>
|
||||
<img src={harmonogramIcon} alt="Obrazek 1" className="w-7 h-7 mr-2" />
|
||||
Harmonogram
|
||||
</li></Link>
|
||||
{userRole !== 'User' && (
|
||||
<>
|
||||
<Link to="/wydatki" className="text-black px-10 py-2 block font-customFont text-center w-max flex-item-center">
|
||||
<Link to="/wydatki" className="text-black px-10 py-2 block font-customFont text-center w-full flex-item-center hover:bg-gray-300 transition duration-100">
|
||||
<li className='flex items-center'>
|
||||
<img src={wydatkiIcon} alt="Obrazek 1" className="w-7 h-7 mr-2" />
|
||||
Wydatki
|
||||
</li></Link>
|
||||
<Link to="/raporty" className="text-black px-10 py-2 block font-customFont text-center w-max flex-item-center">
|
||||
<Link to="/raporty" className="text-black px-10 py-2 block font-customFont text-center w-full flex-item-center hover:bg-gray-300 transition duration-100">
|
||||
<li className='flex items-center'>
|
||||
<img src={raportyIcon} alt="Obrazek 1" className="w-7 h-7 mr-2" />
|
||||
Raporty
|
||||
|
@ -172,7 +172,7 @@ const WidokHarmonogramu = ({ workdays }) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-1/3 bg-gray-100 p-4 rounded-lg h-[350px]">
|
||||
<div className="w-1/3 bg-gray-100 p-4 rounded-lg h-[350px] border border-gray-300 rounded-lg shadow-sm p-4 h-80 overflow-y-scroll">
|
||||
{loading ? (
|
||||
<p className="text-center text-blue-500">Ładowanie danych...</p>
|
||||
) : selectedDay ? (
|
||||
|
@ -203,7 +203,7 @@ const Wydatki = () => {
|
||||
<h2 className="text-lg font-bold mb-4">Czy na pewno chcesz usunąć ten wydatek?</h2>
|
||||
<div className="flex justify-between">
|
||||
<button
|
||||
onClick={() => { handleDeleteExpense(); setShowDeleteModal(false); }}
|
||||
onClick={() => { handleDeleteExpense(); setShowDeleteModal(false); window.scrollTo({ top: 0 }) }}
|
||||
className="bg-red-500 text-white py-2 px-4 rounded"
|
||||
>
|
||||
Tak
|
||||
|
Loading…
Reference in New Issue
Block a user