Compare commits

..

2 Commits

Author SHA1 Message Date
Deforest6342 6822dfe655 fix: change handler order 2026-06-25 18:55:30 +03:00
Deforest6342 22e96d69c3 fix: remake auth form 2026-06-25 18:53:26 +03:00
2 changed files with 65 additions and 56 deletions
+2 -1
View File
@@ -112,7 +112,7 @@ func GetOrder(c *gin.Context) {
} }
func GetAllOrders(c *gin.Context) { func GetAllOrders(c *gin.Context) {
var orders models.Order var orders []models.Order
if err := database.DB.Preload("Items.Item").Find(&orders).Error; err != nil { if err := database.DB.Preload("Items.Item").Find(&orders).Error; err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Не удалось вывести заказы"}) c.JSON(http.StatusInternalServerError, gin.H{"error": "Не удалось вывести заказы"})
@@ -136,6 +136,7 @@ func UpdateOrderStatus(c *gin.Context) {
if req.Status != "new" && req.Status != "packed" && req.Status != "delivered" && req.Status != "cancel" { if req.Status != "new" && req.Status != "packed" && req.Status != "delivered" && req.Status != "cancel" {
c.JSON(http.StatusBadRequest, gin.H{"error": "Неверно указанный статус заказа"}) c.JSON(http.StatusBadRequest, gin.H{"error": "Неверно указанный статус заказа"})
return
} }
result := database.DB.Model(&models.Order{}).Where("id = ? ", orderID).Update("status", req.Status) result := database.DB.Model(&models.Order{}).Where("id = ? ", orderID).Update("status", req.Status)
+63 -55
View File
@@ -1,5 +1,6 @@
import { useState } from "react"; import { useState } from "react";
import axios from "axios"; import axios from "axios";
import bgFish from "../assets/Исходники/background.jpg";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
const AuthForm = () => { const AuthForm = () => {
@@ -57,75 +58,82 @@ const AuthForm = () => {
setError(""); setError("");
}; };
// общий класс для всех полей ввода — фирменный стиль
const inputClass =
"block w-full rounded-md bg-white/5 border border-white/10 px-4 py-3 text-white placeholder-white/40 focus:border-gold focus:outline-none transition-colors";
return ( return (
<div className="flex min-h-screen items-center justify-center bg-gray-100 px-4"> <div className="relative flex min-h-screen items-center justify-center px-4 overflow-hidden">
<div className="w-full max-w-md space-y-8 rounded-lg bg-white p-10 shadow-md"> <div
<h2 className="text-center text-3xl font-bold text-gray-900"> className="absolute inset-0 bg-cover bg-center"
{isLogin ? "Вход в FISH FISH" : "Регистрация в FISH FISH"} style={{ backgroundImage: `url(${bgFish})` }}
/>
<div className="absolute inset-0 bg-slate-900/75" />
<div className="relative w-full max-w-md space-y-6 rounded-lg bg-slate-800/60 border border-slate-700/50 p-8 md:p-10">
<h2 className="text-center text-2xl md:text-3xl font-medium uppercase text-white">
{isLogin ? "Вход" : "Регистрация"}
</h2> </h2>
<form className="mt-8 space-y-6" onSubmit={handleSubmit}> <form className="space-y-4" onSubmit={handleSubmit}>
<div className="rounded-md shadow-sm space-y-px"> <input
<input type="text"
type="text" required
required className={inputClass}
className="relative block w-full rounded-t-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-blue-500 focus:outline-none sm:text-sm" placeholder="Логин"
placeholder="Логин" value={formData.username}
value={formData.username} onChange={handleChange("username")}
onChange={handleChange("username")} />
/> <input
<input type="password"
type="password" required
required className={inputClass}
className="relative block w-full rounded-b-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-blue-500 focus:outline-none sm:text-sm" placeholder="Пароль"
placeholder="Пароль" value={formData.password}
value={formData.password} onChange={handleChange("password")}
onChange={handleChange("password")} />
/>
{!isLogin && ( {!isLogin && (
<> <>
<input <input
type="text" type="text"
required required
className="relative block w-full rounded-t-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-blue-500 focus:outline-none sm:text-sm" className={inputClass}
placeholder="Имя" placeholder="Имя"
value={formData.first_name} value={formData.first_name}
onChange={handleChange("first_name")} onChange={handleChange("first_name")}
/> />
<input <input
type="text" type="text"
required required
className="relative block w-full rounded-t-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-blue-500 focus:outline-none sm:text-sm" className={inputClass}
placeholder="Фамилия" placeholder="Фамилия"
value={formData.last_name} value={formData.last_name}
onChange={handleChange("last_name")} onChange={handleChange("last_name")}
/> />
<input <input
type="text" type="text"
required required
className="relative block w-full rounded-t-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-blue-500 focus:outline-none sm:text-sm" className={inputClass}
placeholder="Номер телефона" placeholder="Номер телефона"
value={formData.phone} value={formData.phone}
onChange={handleChange("phone")} onChange={handleChange("phone")}
/> />
</> </>
)} )}
</div>
{error && <p className="text-center text-sm text-red-600">{error}</p>} {error && <p className="text-center text-sm text-red-400">{error}</p>}
<button <button
type="submit" type="submit"
className="group relative flex w-full justify-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700" className="w-full rounded-md bg-gold text-black px-4 py-3 text-sm font-medium uppercase tracking-wide hover:opacity-90 transition-opacity"
> >
{isLogin ? "Войти" : "Зарегистрироваться"} {isLogin ? "Войти" : "Зарегистрироваться"}
</button> </button>
<p className="text-center text-sm text-gray-600"> <p className="text-center text-sm text-white/60">
{isLogin ? "Нет аккаунта?" : "Уже есть аккаунт?"}{" "} {isLogin ? "Нет аккаунта?" : "Уже есть аккаунт?"}{" "}
<span <span
className="cursor-pointer text-blue-600 hover:underline" className="cursor-pointer text-gold hover:underline"
onClick={toggleMode} onClick={toggleMode}
> >
{isLogin ? "Зарегистрироваться" : "Войти"} {isLogin ? "Зарегистрироваться" : "Войти"}