Merge pull request 'fe-poprawki2' (#4) from fe-poprawki2 into master
Reviewed-on: #4
This commit is contained in:
commit
fca08213ff
@ -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 = () => {
|
||||
|
@ -84,22 +84,18 @@ const DodawanieProduktu = () => {
|
||||
<h2 className="text-2xl font-semibold text-gray-900 mb-8">Dodaj nowy produkt lub usługę</h2>
|
||||
{error && <p className="text-red-500 mb-4">{error}</p>}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<input
|
||||
<div>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Nazwa</label>
|
||||
<input
|
||||
type="text"
|
||||
name="name"
|
||||
value={newProduct.name}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Nazwa produktu lub usługi"
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
name="description"
|
||||
value={newProduct.description}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Opis"
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
/>
|
||||
/></div>
|
||||
<div>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Cena</label>
|
||||
<input
|
||||
type="number"
|
||||
step="0.01"
|
||||
@ -109,38 +105,75 @@ const DodawanieProduktu = () => {
|
||||
placeholder="Cena"
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
/>
|
||||
<select
|
||||
name="type"
|
||||
value={newProduct.type}
|
||||
</div>
|
||||
<div>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Typ</label>
|
||||
<div className="flex items-center space-x-6">
|
||||
<label className="flex items-center space">
|
||||
<input
|
||||
type="radio"
|
||||
name="type"
|
||||
value="1"
|
||||
checked={newProduct.type === "1"}
|
||||
onChange={handleInputChange}
|
||||
className="form-radio h-5 w-5 text-blue-500 focus:ring-blue-500"
|
||||
/>
|
||||
<span className="ml-2">Produkt</span>
|
||||
</label>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
name="type"
|
||||
value="0"
|
||||
checked={newProduct.type === "0"}
|
||||
onChange={handleInputChange}
|
||||
className="form-radio h-5 w-5 text-blue-500 focus:ring-blue-500"
|
||||
/>
|
||||
<span className="ml-2">Usługa</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Dostępność (ilość)</label>
|
||||
<input
|
||||
type="number"
|
||||
name="availability"
|
||||
value={newProduct.type === "0" ? 0 : newProduct.availability}
|
||||
onChange={(e) => {
|
||||
if (newProduct.type === "1") handleInputChange(e);
|
||||
}}
|
||||
disabled={newProduct.type === "0"}
|
||||
className={`block w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none ${
|
||||
newProduct.type === "0" ? "bg-gray-200 text-gray-500 cursor-not-allowed" : "border-gray-300"
|
||||
}`}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<label className="block mb-2 text-gray-700 font-medium">Opis</label>
|
||||
<input
|
||||
type="text"
|
||||
name="description"
|
||||
value={newProduct.description}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Opis"
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
>
|
||||
<option value="1">Produkt</option>
|
||||
<option value="0">Usługa</option>
|
||||
</select>
|
||||
{newProduct.type === '1' && (
|
||||
<input
|
||||
type="number"
|
||||
name="availability"
|
||||
value={newProduct.availability}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Dostępność (ilość)"
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div className="mt-6 flex justify-between">
|
||||
<button
|
||||
onClick={handleCancel}
|
||||
className="bg-gradient-to-r from-red-500 to-red-700 text-white py-2 px-4 rounded-lg hover:from-red-600 hover:to-red-800 transition"
|
||||
>Anuluj</button>
|
||||
<button
|
||||
<button
|
||||
onClick={handleAddProduct}
|
||||
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
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
onClick={handleCancel}
|
||||
className="bg-gradient-to-r from-red-500 to-red-700 text-white py-2 px-4 rounded-lg hover:from-red-600 hover:to-red-800 transition"
|
||||
>Anuluj</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -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,
|
||||
@ -218,15 +220,13 @@ const DodawanieTransakcji = () => {
|
||||
placeholder="Ilość"
|
||||
className="w-24 px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
{/*<button
|
||||
onClick={() => handleRemoveProduct(index)}
|
||||
className="bg-gradient-to-r from-red-500 to-red-700 text-white py-2 px-4 rounded-lg hover:from-red-600 hover:to-red-800 transition"
|
||||
>
|
||||
Usuń
|
||||
</button>*/}
|
||||
<button
|
||||
onClick={handleRemoveProduct}
|
||||
className="relative flex items-center justify-center w-10 h-10 rounded-full text-gray-500 hover:text-red-600 hover:bg-red-100 active:bg-red-200 transition focus:outline-none"
|
||||
onClick={() => handleRemoveProduct(index)}
|
||||
className={`relative flex items-center justify-center w-10 h-10 rounded-full transition focus:outline-none ${newTransaction.transactionProducts.length > 1
|
||||
? "text-gray-500 hover:text-red-600 hover:bg-red-100 active:bg-red-200"
|
||||
: "text-gray-300 cursor-not-allowed"
|
||||
}`}
|
||||
disabled={newTransaction.transactionProducts.length <= 1}
|
||||
>
|
||||
<MinusIcon className="w-5 h-5" />
|
||||
</button>
|
||||
@ -242,14 +242,6 @@ const DodawanieTransakcji = () => {
|
||||
Dodaj produkt
|
||||
</button>
|
||||
</div>
|
||||
{/*<input
|
||||
type="text"
|
||||
name="paymentType"
|
||||
value={newTransaction.paymentType}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Sposób płatności"
|
||||
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 className="mt-6 flex justify-between">
|
||||
<div className="mb-4">
|
||||
<label className="block mb-2 text-gray-700 font-medium">Metoda płatności</label>
|
||||
@ -290,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>
|
||||
|
||||
|
@ -133,9 +133,10 @@ const EdycjaProduktu = () => {
|
||||
<div className="p-8 bg-white rounded-lg shadow-lg border border-gray-200 w-full max-w-4xl h-max">
|
||||
<h2 className="text-2xl font-semibold text-gray-900 mb-4">Edycja produktu</h2>
|
||||
{errors.general && <p className="text-red-500 mb-4">{errors.general}</p>}
|
||||
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div className="relative">
|
||||
<label className="block mb-2 text-gray-700 font-medium">Nazwa</label>
|
||||
<input
|
||||
type="text"
|
||||
name="name"
|
||||
@ -146,20 +147,8 @@ const EdycjaProduktu = () => {
|
||||
/>
|
||||
{errors.name && <span className="absolute text-red-500 text-sm">{errors.name}</span>}
|
||||
</div>
|
||||
|
||||
<div className="relative">
|
||||
<input
|
||||
type="text"
|
||||
name="description"
|
||||
value={product.description}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Opis"
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
/>
|
||||
{errors.description && <span className="absolute text-red-500 text-sm">{errors.description}</span>}
|
||||
</div>
|
||||
|
||||
<div className="relative">
|
||||
<label className="block mb-2 text-gray-700 font-medium">Cena</label>
|
||||
<input
|
||||
type="number"
|
||||
step="0.01"
|
||||
@ -171,50 +160,80 @@ const EdycjaProduktu = () => {
|
||||
/>
|
||||
{errors.price && <span className="absolute text-red-500 text-sm">{errors.price}</span>}
|
||||
</div>
|
||||
|
||||
|
||||
<div className="relative">
|
||||
<select
|
||||
name="type"
|
||||
value={product.type}
|
||||
onChange={handleInputChange}
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
>
|
||||
<option value="1">Produkt</option>
|
||||
<option value="0">Usługa</option>
|
||||
</select>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Typ</label>
|
||||
<div className="flex items-center space-x-6">
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
name="type"
|
||||
value="1"
|
||||
checked={product.type === "1"}
|
||||
onChange={handleInputChange}
|
||||
className="form-radio h-5 w-5 text-blue-500 focus:ring-blue-500"
|
||||
/>
|
||||
<span className="ml-2">Produkt</span>
|
||||
</label>
|
||||
<label className="flex items-center">
|
||||
<input
|
||||
type="radio"
|
||||
name="type"
|
||||
value="0"
|
||||
checked={product.type === "0"}
|
||||
onChange={handleInputChange}
|
||||
className="form-radio h-5 w-5 text-blue-500 focus:ring-blue-500"
|
||||
/>
|
||||
<span className="ml-2">Usługa</span>
|
||||
</label>
|
||||
{errors.type && <span className="absolute text-red-500 text-sm">{errors.type}</span>}
|
||||
</div>
|
||||
|
||||
{product.type === '1' && (
|
||||
<div className="relative">
|
||||
<input
|
||||
type="number"
|
||||
name="availability"
|
||||
value={product.availability}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Dostępność (ilość)"
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
/>
|
||||
{errors.availability && <span className="absolute text-red-500 text-sm">{errors.availability}</span>}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
<label className="block mb-2 text-gray-700 font-medium">Dostępność (ilość)</label>
|
||||
<input
|
||||
type="number"
|
||||
name="availability"
|
||||
value={product.type === "0" ? 0 : product.availability}
|
||||
onChange={(e) => {
|
||||
if (product.type === "1") handleInputChange(e);
|
||||
}}
|
||||
disabled={product.type === "0"}
|
||||
className={`block w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none ${product.type === "0" ? "bg-gray-200 text-gray-500 cursor-not-allowed" : "border-gray-300"
|
||||
}`}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<label className="block mb-2 text-gray-700 font-medium">Opis</label>
|
||||
<input
|
||||
type="text"
|
||||
name="description"
|
||||
value={product.description}
|
||||
onChange={handleInputChange}
|
||||
placeholder="Opis"
|
||||
className="block w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="mt-6 flex justify-between">
|
||||
<button
|
||||
onClick={handleCancel}
|
||||
className="bg-gradient-to-r from-red-500 to-red-700 text-white py-2 px-4 rounded-lg hover:from-red-600 hover:to-red-800 transition"
|
||||
>Anuluj</button>
|
||||
<button
|
||||
onClick={handleSaveChanges}
|
||||
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"
|
||||
>
|
||||
Zapisz zmiany
|
||||
</button>
|
||||
<button
|
||||
onClick={handleCancel}
|
||||
className="bg-gradient-to-r from-red-500 to-red-700 text-white py-2 px-4 rounded-lg hover:from-red-600 hover:to-red-800 transition"
|
||||
>Anuluj
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
export default EdycjaProduktu;
|
||||
|
@ -255,12 +255,16 @@ const EdycjaTransakcji = () => {
|
||||
placeholder="Ilość"
|
||||
className="w-24 px-4 py-2 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
<button
|
||||
onClick={() => handleRemoveProduct(index)}
|
||||
className="relative flex items-center justify-center w-10 h-10 rounded-full text-gray-500 hover:text-red-600 hover:bg-red-100 active:bg-red-200 transition focus:outline-none"
|
||||
>
|
||||
<MinusIcon className="w-5 h-5" />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => handleRemoveProduct(index)}
|
||||
className={`relative flex items-center justify-center w-10 h-10 rounded-full transition focus:outline-none ${transaction.transactionProducts.length > 1
|
||||
? "text-gray-500 hover:text-red-600 hover:bg-red-100 active:bg-red-200"
|
||||
: "text-gray-300 cursor-not-allowed"
|
||||
}`}
|
||||
disabled={transaction.transactionProducts.length <= 1}
|
||||
>
|
||||
<MinusIcon className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
<button
|
||||
@ -312,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>
|
||||
|
@ -214,6 +214,11 @@ const Harmonogram = () => {
|
||||
|
||||
|
||||
return (
|
||||
<div className='p-10 ml-11'>
|
||||
<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">Harmonogram</h1>
|
||||
</div>
|
||||
|
||||
<div className="container mx-auto px-4 py-6">
|
||||
<div className="flex justify-between items-center mb-6">
|
||||
<div className="text-lg font-semibold">
|
||||
@ -227,7 +232,6 @@ const Harmonogram = () => {
|
||||
{isWorking ? 'Zakończ pracę' : 'Rozpocznij pracę'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-6">
|
||||
<div className="w-2/3">
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
@ -259,7 +263,7 @@ const Harmonogram = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-1/3 bg-gray-100 p-4 rounded-lg">
|
||||
<div className="w-1/3 bg-gray-100 p-4 rounded-lg h-[350px]">
|
||||
{loading ? (
|
||||
<p className="text-center text-blue-500">Ładowanie danych...</p>
|
||||
) : selectedDay ? (
|
||||
@ -299,7 +303,7 @@ const Harmonogram = () => {
|
||||
<p className="text-center text-gray-500">Wybierz dzień, aby zobaczyć szczegóły.</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</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,
|
||||
@ -105,7 +105,7 @@ const PanelAdministratora = () => {
|
||||
return (
|
||||
<div className='p-10 ml-11'>
|
||||
<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">Panel Administratora</h1>
|
||||
<h1 className="text-white text-4xl font-semibold">Panel administratora</h1>
|
||||
<div className="mr-10 text-lg flex">
|
||||
<div className='px-5'>
|
||||
<button
|
||||
@ -146,7 +146,7 @@ const PanelAdministratora = () => {
|
||||
<div className="flex justify-center items-start pt-10">
|
||||
<div className="bg-white p-8 rounded-xl shadow-lg w-full max-w-md">
|
||||
<div className="mb-6">
|
||||
<h2 className="text-2xl font-semibold text-center mb-4">Pobierz Raport</h2>
|
||||
<h2 className="text-2xl font-semibold text-center mb-4">Pobierz raport</h2>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="reportType" className="block text-lg font-medium text-gray-700 mb-2">Wybierz typ raportu:</label>
|
||||
@ -188,7 +188,7 @@ const PanelAdministratora = () => {
|
||||
onClick={downloadReport}
|
||||
className="w-full bg-blue-500 text-white py-3 px-4 rounded-lg mt-4 hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300"
|
||||
>
|
||||
Pobierz Raport
|
||||
Pobierz raport
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -228,7 +228,7 @@ const PanelAdministratora = () => {
|
||||
<div className="flex justify-center items-start pt-10">
|
||||
<div className="bg-white p-8 rounded-xl shadow-lg w-full max-w-md">
|
||||
<div className="mb-6">
|
||||
<h2 className="text-2xl font-semibold text-center mb-4">Dodaj Absencję</h2>
|
||||
<h2 className="text-2xl font-semibold text-center mb-4">Dodaj absencję</h2>
|
||||
|
||||
<div className="mb-4">
|
||||
<label htmlFor="email" className="block text-lg font-medium text-gray-700 mb-2">Wybierz email:</label>
|
||||
@ -285,7 +285,7 @@ const PanelAdministratora = () => {
|
||||
onClick={addAbsence}
|
||||
className="w-full bg-blue-500 text-white py-3 px-4 rounded-lg mt-4 hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 transition duration-300"
|
||||
>
|
||||
Dodaj Absencję
|
||||
Dodaj absencję
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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">
|
||||
<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