limite de qty pour qtyselect pour pas ralentir avec des très grand nombres.

This commit is contained in:
Victor Turgeon 2022-11-08 00:58:55 -05:00
parent 30d3c520ac
commit 5cbf9e4137
6 changed files with 1456 additions and 19 deletions

View File

@ -167,7 +167,7 @@ public class InventoryContext : IdentityDbContext<InventoryUser> {
Status = ProductModel.States.Clearance, Status = ProductModel.States.Clearance,
Price = 3.45M, Price = 3.45M,
PromoPrice = 1.99M, PromoPrice = 1.99M,
Quantity = 164363, Quantity = 99,
ImageName = @"$vhs.jpg" ImageName = @"$vhs.jpg"
}); });
modelBuilder.Entity<ProductModel>().HasData(new ProductModel { modelBuilder.Entity<ProductModel>().HasData(new ProductModel {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,184 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GrossesMitainesAPI.Migrations
{
public partial class wtf : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "1b7b9c55-c746-493a-a24f-3d5ca937298e",
column: "ConcurrencyStamp",
value: "272b790a-dd0f-44d1-9fe6-3bdd94dd0bbe");
migrationBuilder.UpdateData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "c9e08b20-d8a5-473f-9f52-572eb23c12af",
column: "ConcurrencyStamp",
value: "efa553a4-bce0-4f02-8e71-948ffcd33485");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "69b434ec-a04a-44a2-8b36-01ab06f86acd", "AQAAAAEAACcQAAAAEHIDM2Enov0RAshapK1ffH4rvsub/fggHOEcJ36Is4Oo9oOTQcp8F4Cc2JkAajRYCQ==", "6398533a-0475-422e-a961-d028eb0422c0" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "ecf7503a-591c-454e-a824-048e10bd0474",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "64bca06c-8b14-4cb1-a768-8330f6211898", "AQAAAAEAACcQAAAAEKe5FzTpH4cwdtISsiyLAadJYa0nHiqp0lgK2eG9b4J1san84/07GAKLiasqGPCl4A==", "61ce3796-d6be-41fa-9ce1-c121ed8181e9" });
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 1,
column: "PurchaseDate",
value: new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6271));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 2,
column: "PurchaseDate",
value: new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6322));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 3,
column: "PurchaseDate",
value: new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6345));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 4,
column: "PurchaseDate",
value: new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6348));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 5,
column: "PurchaseDate",
value: new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6350));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 6,
column: "PurchaseDate",
value: new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6351));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 7,
column: "PurchaseDate",
value: new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6359));
migrationBuilder.UpdateData(
table: "Products",
keyColumn: "Id",
keyValue: 14,
column: "Quantity",
value: 99L);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "1b7b9c55-c746-493a-a24f-3d5ca937298e",
column: "ConcurrencyStamp",
value: "31012aa2-ebcf-493a-bc1c-2066d47dd333");
migrationBuilder.UpdateData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "c9e08b20-d8a5-473f-9f52-572eb23c12af",
column: "ConcurrencyStamp",
value: "b110abae-bf70-453d-93d4-a3b0d74f9491");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "989931b3-2a7b-44db-8e22-308d2270442c", "AQAAAAEAACcQAAAAEPffpp6X7ztCzWieTbiRInK5P/1AZx6Pdy1tUbTQS5GXLWGcZzhqlzaB8QGlwkJzDw==", "6bbc335f-1307-40eb-8533-694a608937de" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "ecf7503a-591c-454e-a824-048e10bd0474",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "d6f87641-e92e-44f6-a26c-3539ccc0b374", "AQAAAAEAACcQAAAAEGleiGV7pLvmGVcR9JU/Yc8Oo/+8CGFU2ZDvWJnonvm5/XbCOHsIwWHvAB3GCpiZJA==", "719b228c-6b86-4193-b994-365aaf1d19fc" });
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 1,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9693));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 2,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9731));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 3,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9733));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 4,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9735));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 5,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9736));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 6,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9738));
migrationBuilder.UpdateData(
table: "Invoices",
keyColumn: "Id",
keyValue: 7,
column: "PurchaseDate",
value: new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9740));
migrationBuilder.UpdateData(
table: "Products",
keyColumn: "Id",
keyValue: 14,
column: "Quantity",
value: 164363L);
}
}
}

View File

@ -101,7 +101,7 @@ namespace GrossesMitainesAPI.Migrations
{ {
Id = "ecf7503a-591c-454e-a824-048e10bd0474", Id = "ecf7503a-591c-454e-a824-048e10bd0474",
AccessFailedCount = 0, AccessFailedCount = 0,
ConcurrencyStamp = "d6f87641-e92e-44f6-a26c-3539ccc0b374", ConcurrencyStamp = "64bca06c-8b14-4cb1-a768-8330f6211898",
Email = "admin@admin.com", Email = "admin@admin.com",
EmailConfirmed = false, EmailConfirmed = false,
FirstName = "Roger", FirstName = "Roger",
@ -109,9 +109,9 @@ namespace GrossesMitainesAPI.Migrations
LockoutEnabled = false, LockoutEnabled = false,
NormalizedEmail = "ADMIN@ADMIN.COM", NormalizedEmail = "ADMIN@ADMIN.COM",
NormalizedUserName = "ADMIN", NormalizedUserName = "ADMIN",
PasswordHash = "AQAAAAEAACcQAAAAEGleiGV7pLvmGVcR9JU/Yc8Oo/+8CGFU2ZDvWJnonvm5/XbCOHsIwWHvAB3GCpiZJA==", PasswordHash = "AQAAAAEAACcQAAAAEKe5FzTpH4cwdtISsiyLAadJYa0nHiqp0lgK2eG9b4J1san84/07GAKLiasqGPCl4A==",
PhoneNumberConfirmed = false, PhoneNumberConfirmed = false,
SecurityStamp = "719b228c-6b86-4193-b994-365aaf1d19fc", SecurityStamp = "61ce3796-d6be-41fa-9ce1-c121ed8181e9",
TwoFactorEnabled = false, TwoFactorEnabled = false,
UserName = "Admin" UserName = "Admin"
}, },
@ -119,7 +119,7 @@ namespace GrossesMitainesAPI.Migrations
{ {
Id = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", Id = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
AccessFailedCount = 0, AccessFailedCount = 0,
ConcurrencyStamp = "989931b3-2a7b-44db-8e22-308d2270442c", ConcurrencyStamp = "69b434ec-a04a-44a2-8b36-01ab06f86acd",
Email = "paul@exemple.com", Email = "paul@exemple.com",
EmailConfirmed = false, EmailConfirmed = false,
FirstName = "Paul", FirstName = "Paul",
@ -127,9 +127,9 @@ namespace GrossesMitainesAPI.Migrations
LockoutEnabled = false, LockoutEnabled = false,
NormalizedEmail = "PAUL@EXEMPLE.COM", NormalizedEmail = "PAUL@EXEMPLE.COM",
NormalizedUserName = "PASLA", NormalizedUserName = "PASLA",
PasswordHash = "AQAAAAEAACcQAAAAEPffpp6X7ztCzWieTbiRInK5P/1AZx6Pdy1tUbTQS5GXLWGcZzhqlzaB8QGlwkJzDw==", PasswordHash = "AQAAAAEAACcQAAAAEHIDM2Enov0RAshapK1ffH4rvsub/fggHOEcJ36Is4Oo9oOTQcp8F4Cc2JkAajRYCQ==",
PhoneNumberConfirmed = false, PhoneNumberConfirmed = false,
SecurityStamp = "6bbc335f-1307-40eb-8533-694a608937de", SecurityStamp = "6398533a-0475-422e-a961-d028eb0422c0",
TwoFactorEnabled = false, TwoFactorEnabled = false,
UserName = "PasLa" UserName = "PasLa"
}); });
@ -274,7 +274,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin", LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474", LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111", PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9693), PurchaseDate = new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6271),
ShippingAddressId = 1, ShippingAddressId = 1,
Status = 0 Status = 0
}, },
@ -286,7 +286,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin", LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474", LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111", PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9731), PurchaseDate = new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6322),
ShippingAddressId = 1, ShippingAddressId = 1,
Status = 1 Status = 1
}, },
@ -298,7 +298,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin", LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474", LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111", PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9733), PurchaseDate = new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6345),
ShippingAddressId = 1, ShippingAddressId = 1,
Status = 3 Status = 3
}, },
@ -310,7 +310,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin", LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474", LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111", PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9735), PurchaseDate = new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6348),
ShippingAddressId = 1, ShippingAddressId = 1,
Status = 4 Status = 4
}, },
@ -322,7 +322,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "Admin", LastName = "Admin",
LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474", LinkedAccountId = "ecf7503a-591c-454e-a824-048e10bd0474",
PhoneNumber = "111-111-1111", PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9736), PurchaseDate = new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6350),
ShippingAddressId = 1, ShippingAddressId = 1,
Status = 5 Status = 5
}, },
@ -333,7 +333,7 @@ namespace GrossesMitainesAPI.Migrations
FirstName = "Jérémy", FirstName = "Jérémy",
LastName = "Le Petit", LastName = "Le Petit",
PhoneNumber = "111-111-1111", PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9738), PurchaseDate = new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6351),
ShippingAddressId = 2, ShippingAddressId = 2,
Status = 0 Status = 0
}, },
@ -345,7 +345,7 @@ namespace GrossesMitainesAPI.Migrations
LastName = "A.", LastName = "A.",
LinkedAccountId = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09", LinkedAccountId = "af9178c8-1a02-4ff8-bc0a-c8248dad6e09",
PhoneNumber = "111-111-1111", PhoneNumber = "111-111-1111",
PurchaseDate = new DateTime(2022, 11, 7, 22, 49, 52, 210, DateTimeKind.Local).AddTicks(9740), PurchaseDate = new DateTime(2022, 11, 8, 0, 54, 40, 171, DateTimeKind.Local).AddTicks(6359),
ShippingAddressId = 3, ShippingAddressId = 3,
Status = 3 Status = 3
}); });
@ -749,7 +749,7 @@ namespace GrossesMitainesAPI.Migrations
ImageName = "$vhs.jpg", ImageName = "$vhs.jpg",
Price = 3.45m, Price = 3.45m,
PromoPrice = 1.99m, PromoPrice = 1.99m,
Quantity = 164363L, Quantity = 99L,
Sales = 0L, Sales = 0L,
Status = 3, Status = 3,
Title = "VHS de la Guerre des Tuques" Title = "VHS de la Guerre des Tuques"
@ -1010,14 +1010,14 @@ namespace GrossesMitainesAPI.Migrations
new new
{ {
Id = "c9e08b20-d8a5-473f-9f52-572eb23c12af", Id = "c9e08b20-d8a5-473f-9f52-572eb23c12af",
ConcurrencyStamp = "b110abae-bf70-453d-93d4-a3b0d74f9491", ConcurrencyStamp = "efa553a4-bce0-4f02-8e71-948ffcd33485",
Name = "Administrateur", Name = "Administrateur",
NormalizedName = "ADMINISTRATEUR" NormalizedName = "ADMINISTRATEUR"
}, },
new new
{ {
Id = "1b7b9c55-c746-493a-a24f-3d5ca937298e", Id = "1b7b9c55-c746-493a-a24f-3d5ca937298e",
ConcurrencyStamp = "31012aa2-ebcf-493a-bc1c-2066d47dd333", ConcurrencyStamp = "272b790a-dd0f-44d1-9fe6-3bdd94dd0bbe",
Name = "Client", Name = "Client",
NormalizedName = "CLIENT" NormalizedName = "CLIENT"
}); });

View File

@ -14,7 +14,7 @@ export const CartContext = createContext({
export function CartProvider({ children }) { export function CartProvider({ children }) {
const [cookies, setCookie] = useCookies(['cart']); const [cartCookie,setCartCookie] = useCookies(['cart'])
const [cartProducts, setCartProducts] = useState([]); const [cartProducts, setCartProducts] = useState([]);
function addToCart(product, qty) { function addToCart(product, qty) {

View File

@ -3,7 +3,7 @@ import { Form } from "react-bootstrap";
const QtySelect = ({onChange, qty }) => { const QtySelect = ({onChange, qty }) => {
return ( return (
<Form.Select onChange={(e)=>onChange(e.target.value)} className="qty-select"> <Form.Select onChange={(e)=>onChange(e.target.value)} className="qty-select">
{Array.from(Array(qty), (e, i) => { {Array.from(Array(qty <= 99 ? qty : 99), (e, i) => {
return ( return (
<option value={i+1} key={i+1}>{i+1}</option> <option value={i+1} key={i+1}>{i+1}</option>
) )