From 36f934a60182d37090e63505ae04ab8df74bd7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=AD=D8=B3=DB=8C=D9=86=20=D9=85=D8=B9=D8=B5=D9=88=D9=85?= =?UTF-8?q?=DB=8C=20=D9=BE=D9=88=D8=B1?= Date: Fri, 16 Feb 2024 18:23:02 +0330 Subject: [PATCH] publish --- components/Cards/CardCart/page.jsx | 45 +- components/Cards/CardCategories/page.jsx | 2 +- .../Cards/CardCategoriesMobile/page.jsx | 46 +- components/Cards/CardNormal/page.jsx | 95 +- .../Cards/Components/AddToCart/page.jsx | 134 +- .../Carts/component/NavBarDownCart/page.jsx | 24 +- components/Category/FilterCategory/page.jsx | 2 + components/Category/ListProdocts/page.jsx | 15 +- .../Mobile/FilterCategoryMobile/page.jsx | 2 + .../Mobile/ListProductsMobile/page.jsx | 13 +- .../Category/PaginationCategoory/page.jsx | 70 +- components/Footer/page.jsx | 22 +- components/Navbar/page.jsx | 145 +- iranCities.js | 2570 +++++++++++++++++ iranProvince.js | 221 ++ package-lock.json | 111 +- package.json | 3 + plugins/Chapar/index.js | 2 +- plugins/Gallery/page.jsx | 103 +- plugins/bottomSheet/BottomSheetAddress.jsx | 390 +++ .../bottomSheet/BottomSheetDeleteAddress.jsx | 50 + plugins/bottomSheet/BottomSheetDiscount.jsx | 36 +- plugins/bottomSheet/BottomSheetLogOut.jsx | 46 + src/app/cart/checkout/page.jsx | 742 ++--- src/app/cart/page.jsx | 148 +- src/app/categories/[id]/page.jsx | 141 +- src/app/faq/page.jsx | 81 + src/app/layout.jsx | 145 +- src/app/login/page.jsx | 3 +- src/app/page.jsx | 6 +- src/app/products/{[id] => [...id]}/page.jsx | 278 +- src/app/profile/address/page.jsx | 96 + .../profile/component/SideBarProfile/page.jsx | 75 + src/app/profile/orders/page.jsx | 129 +- src/app/profile/page.jsx | 67 +- src/app/purchase-callback/page.jsx | 95 + src/app/terms-and-conditions/page.jsx | 96 + style/globals.css | 26 + 38 files changed, 5248 insertions(+), 1027 deletions(-) create mode 100644 iranCities.js create mode 100644 iranProvince.js create mode 100644 plugins/bottomSheet/BottomSheetAddress.jsx create mode 100644 plugins/bottomSheet/BottomSheetDeleteAddress.jsx create mode 100644 plugins/bottomSheet/BottomSheetLogOut.jsx create mode 100644 src/app/faq/page.jsx rename src/app/products/{[id] => [...id]}/page.jsx (50%) create mode 100644 src/app/profile/address/page.jsx create mode 100644 src/app/profile/component/SideBarProfile/page.jsx create mode 100644 src/app/purchase-callback/page.jsx create mode 100644 src/app/terms-and-conditions/page.jsx diff --git a/components/Cards/CardCart/page.jsx b/components/Cards/CardCart/page.jsx index b6b42bc..26b908b 100644 --- a/components/Cards/CardCart/page.jsx +++ b/components/Cards/CardCart/page.jsx @@ -6,40 +6,45 @@ import logo from "../../../public/images/logo.png"; import p2 from "../../../public/images/product/2.png"; import AppContext from "@ctx/AppContext"; import AddToCart from "../Components/AddToCart/page"; +import Link from "next/link"; const CardCart = ({ data }) => { const CTX = useContext(AppContext); return (
-
- {!!data.mainImage ? ( - - ) : ( -
+ +
+ {!!data.mainImage ? ( -
- )} -
+ ) : ( +
+ +
+ )} +
+
-

- {data?.persianName} -

+ +

+ {data?.persianName} +

+
- +
{data?.hasDiscount ? ( -
+

{

- +
{data?.hasDiscount ? ( diff --git a/components/Cards/CardCategoriesMobile/page.jsx b/components/Cards/CardCategoriesMobile/page.jsx index 7af8bd3..f3df682 100644 --- a/components/Cards/CardCategoriesMobile/page.jsx +++ b/components/Cards/CardCategoriesMobile/page.jsx @@ -14,37 +14,41 @@ const CardCategoriesMobile = ({ data }) => { return (
-
- {!!data.mainImage ? ( - - ) : ( -
+ +
+ {!!data.mainImage ? ( -
- )} -
-
-

- {data?.persianName} -

+ ) : ( +
+ +
+ )} +
+ +
+ {" "} + +

+ {data?.persianName} +

+ {data.stock <= 3 && (

{" "} {data.stock}عدد موجود انبار

)} -
- {" "} + {" "}
{data?.hasDiscount ? (
diff --git a/components/Cards/CardNormal/page.jsx b/components/Cards/CardNormal/page.jsx index a318c6f..74b42be 100644 --- a/components/Cards/CardNormal/page.jsx +++ b/components/Cards/CardNormal/page.jsx @@ -7,6 +7,7 @@ import Image from "next/image"; import PersianNumber from "plugins/PersianNumber"; import AppContext from "@ctx/AppContext"; import AddToCart from "../Components/AddToCart/page"; +import Link from "next/link"; const CardNormal = ({ data }) => { const CTX = useContext(AppContext); @@ -15,61 +16,63 @@ const CardNormal = ({ data }) => { <> {" "} <> -
handleRoutineShiftPlanWithDay(index)} - > - {data.hasDiscount && ( -
-
-

- - % -

+ +
handleRoutineShiftPlanWithDay(index)} + > + {data.hasDiscount && ( +
+
+

+ + % +

+
-
- )} + )} -
- {!!data.mainImage ? ( - - ) : ( -
+
+ {!!data.mainImage ? ( -
- )} -
-
-

- {data.persianName}{" "} -

- - {data.stock <= 3 && ( -

- {" "} - {data.stock}عدد موجود انبار + ) : ( +

+ +
+ )} +
+
+

+ {data.persianName}{" "}

- )} + + {data.stock <= 3 && ( +

+ {" "} + {data.stock}عدد موجود انبار +

+ )} +
-
+
- +
diff --git a/components/Cards/Components/AddToCart/page.jsx b/components/Cards/Components/AddToCart/page.jsx index d3dd022..12080b2 100644 --- a/components/Cards/Components/AddToCart/page.jsx +++ b/components/Cards/Components/AddToCart/page.jsx @@ -3,57 +3,115 @@ import AppContext from "@ctx/AppContext"; import PersianNumber from "plugins/PersianNumber"; import React, { useContext } from "react"; -const AddToCart = ({ data }) => { +const AddToCart = ({ data, theme }) => { const CTX = useContext(AppContext); const cart = CTX.state.cart; + console.log( + data?.id, + data?.persianName, + data?.cost, + data?.costWithDiscount, + data?.mainImage, + data?.hasDiscount, + data?.maxOrderCount + ); + const handleAddItemToCart = (id) => { CTX.AddItemToCart( - data.id, - data.persianName, - data.cost, - data.costWithDiscount, - data.mainImage, - data.hasDiscount, - data.maxOrderCount + data?.id, + data?.persianName, + data?.cost, + data?.costWithDiscount, + data?.mainImage, + data?.hasDiscount, + data?.maxOrderCount ); }; return ( <> - {data.stock == 0 ? ( -
-

اتمام موجودی

-
- ) : ( -
- {!cart.find((item) => item.id === data.id) ? ( -
-
handleAddItemToCart()}> -

+

-
+ {theme == 1 && ( + <> + {" "} + {data?.stock == 0 ? ( +
+

اتمام موجودی

) : ( -
-
handleAddItemToCart()} - > -

+

-
-

- item.id === data.id).count} - /> -

-
CTX.RemoveItemFromCart(data.id)} - > -

-

-
+
+ {!cart.find((item) => item.id === data?.id) ? ( +
+
handleAddItemToCart()}> +

+

+
+
+ ) : ( +
+
handleAddItemToCart()} + > +

+

+
+

+ item.id === data?.id).count} + /> +

+
CTX.RemoveItemFromCart(data?.id)} + > +

-

+
+
+ )}
)} -
+ + )} + + {theme == 2 && ( + <> + {" "} + {data?.stock == 0 ? ( +
+

اتمام موجودی

+
+ ) : ( +
+ {!cart.find((item) => item.id === data?.id) ? ( +
+
handleAddItemToCart()}> +

+ افزودن به سبد +

+
+
+ ) : ( +
+
handleAddItemToCart()} + > +

+

+
+

+ item.id === data?.id).count} + /> +

+
CTX.RemoveItemFromCart(data?.id)} + > +

-

+
+
+ )} +
+ )} + )} ); diff --git a/components/Carts/component/NavBarDownCart/page.jsx b/components/Carts/component/NavBarDownCart/page.jsx index e718182..8dd3976 100644 --- a/components/Carts/component/NavBarDownCart/page.jsx +++ b/components/Carts/component/NavBarDownCart/page.jsx @@ -3,17 +3,25 @@ import Link from "next/link"; import PersianNumber from "plugins/PersianNumber"; import React from "react"; -const NavBarDownCart = ({ calculateTotalCost, event }) => { +const NavBarDownCart = ({ calculateTotalCost, event, permissionGoPay }) => { return ( -
+
{/* */} - + + {permissionGoPay ? ( + + ) : ( + + )} + {/* */}

diff --git a/components/Category/FilterCategory/page.jsx b/components/Category/FilterCategory/page.jsx index 2884896..4163e2c 100644 --- a/components/Category/FilterCategory/page.jsx +++ b/components/Category/FilterCategory/page.jsx @@ -19,6 +19,7 @@ const FilterCategory = ({ }) => { const CTX = useContext(AppContext); const brands = CTX.state.brands; + const pageGetProducts = CTX.state.pageGetProducts; const handleCheckboxChange = () => { setIsChecked(!isChecked); @@ -45,6 +46,7 @@ const FilterCategory = ({ useEffect(() => { CTX.fetchProducts( + pageGetProducts, id, selectedBrands, isChecked, diff --git a/components/Category/ListProdocts/page.jsx b/components/Category/ListProdocts/page.jsx index 7bf7df0..a581c36 100644 --- a/components/Category/ListProdocts/page.jsx +++ b/components/Category/ListProdocts/page.jsx @@ -3,6 +3,7 @@ import CardCategories from "@comp/Cards/CardCategories/page"; import AppContext from "@ctx/AppContext"; import PersianNumber from "plugins/PersianNumber"; import React, { useContext, useEffect } from "react"; +import InfiniteScroll from "react-infinite-scroll-component"; const ListProdocts = ({ sortBy, @@ -15,11 +16,13 @@ const ListProdocts = ({ }) => { const CTX = useContext(AppContext); const products = CTX.state.products; - - console.log("products", products); + const pager = CTX.state.pager; + const stopGetTasks = CTX.state.stopGetTasks; + const pageGetProducts = CTX.state.pageGetProducts; useEffect(() => { CTX.fetchProducts( + pageGetProducts, id, selectedBrands, isChecked, @@ -31,7 +34,7 @@ const ListProdocts = ({ }, [sortBy]); return ( -

+
@@ -117,7 +120,7 @@ const ListProdocts = ({

کالا @@ -127,7 +130,9 @@ const ListProdocts = ({

- <>{products && products.map((e) => )} + {products?.map((e) => ( + + ))}
diff --git a/components/Category/Mobile/FilterCategoryMobile/page.jsx b/components/Category/Mobile/FilterCategoryMobile/page.jsx index 5b1da01..aafb779 100644 --- a/components/Category/Mobile/FilterCategoryMobile/page.jsx +++ b/components/Category/Mobile/FilterCategoryMobile/page.jsx @@ -6,11 +6,13 @@ import React, { useContext, useEffect, useState } from "react"; const FilterCategoryMobile = (props) => { const CTX = useContext(AppContext); + const pageGetProducts = CTX.state.pageGetProducts; const [trendFilter, setTrendFilter] = useState(false); useEffect(() => { CTX.fetchProducts( + pageGetProducts, props.id, props.selectedBrands, props.isChecked, diff --git a/components/Category/Mobile/ListProductsMobile/page.jsx b/components/Category/Mobile/ListProductsMobile/page.jsx index ed68ede..822a6f8 100644 --- a/components/Category/Mobile/ListProductsMobile/page.jsx +++ b/components/Category/Mobile/ListProductsMobile/page.jsx @@ -3,16 +3,21 @@ import CardCategoriesMobile from "@comp/Cards/CardCategoriesMobile/page"; import CardNormal from "@comp/Cards/CardNormal/page"; import AppContext from "@ctx/AppContext"; import React, { useContext } from "react"; +import InfiniteScroll from "react-infinite-scroll-component"; const ListProductsMobile = (props) => { const CTX = useContext(AppContext); - const products = CTX.state.products; + const stopGetTasks = CTX.state.stopGetTasks; return ( -
- <>{products && products.map((e) => )} -
+ <> +
+ {products?.map((e) => ( + + ))} +
+ ); }; diff --git a/components/Category/PaginationCategoory/page.jsx b/components/Category/PaginationCategoory/page.jsx index d0a565b..59c6d46 100644 --- a/components/Category/PaginationCategoory/page.jsx +++ b/components/Category/PaginationCategoory/page.jsx @@ -1,7 +1,49 @@ +"use client"; +import AppContext from "@ctx/AppContext"; import PersianNumber from "plugins/PersianNumber"; -import React from "react"; +import React, { useContext, useState } from "react"; const PaginationCategoory = (props) => { + const CTX = useContext(AppContext); + + const pager = CTX.state.pager; + const pageGetProducts = CTX.state.pageGetProducts; + + const [currentPageIndex, setCurrentPageIndex] = useState(pageGetProducts); + const renderPaginationButtons = () => { + const buttons = []; + for (let i = 0; i < pager?.totalPage; i++) { + buttons.push( +
{ + console.log("ss", i); + setCurrentPageIndex(i); + CTX.fetchProducts( + i, + props.id, + props.selectedBrands, + props.isChecked, + props.rangePrice, + props.rangePrice, + props.sortBy, + props.isRangePrice, + true //pagination say or not + ); + }} + > +

+ +

+
+ ); + } + return buttons; + }; + return (
@@ -22,31 +64,7 @@ const PaginationCategoory = (props) => { />
-
-

- -

-
-
-

- -

-
-
-

- -

-
-
-

- -

-
-
-

- -

-
+ {renderPaginationButtons()}
{
    -
  • - سوالات متداول{" "} -
  • -
  • تماس باما
  • -
  • قوانین سایت
  • -
  • درباره ما
  • + +
  • + سوالات متداول{" "} +
  • + + +
  • تماس باما
  • + + +
  • + قوانین سایت +
  • + + +
  • درباره ما
  • +
diff --git a/components/Navbar/page.jsx b/components/Navbar/page.jsx index 071b533..4ef053f 100644 --- a/components/Navbar/page.jsx +++ b/components/Navbar/page.jsx @@ -22,6 +22,7 @@ const Navbar = ({ theme }) => { const CTX = useContext(AppContext); const dataNav = CTX.state.navData; + const profile = CTX.state.profile; const cart = CTX.state.cart; const [navItemHover, setNavItemHover] = useState(null); @@ -81,11 +82,13 @@ const Navbar = ({ theme }) => {
- {1 == 2 ? ( + {profile?.length <= 0 ? (
-
- ورود / عضویت{" "} -
+ +
+ ورود / عضویت{" "} +
+
) : (
@@ -94,7 +97,9 @@ const Navbar = ({ theme }) => { className="bg-gray-100 py-2 px-5 rounded-xl text-sm flex cursor-pointer " onClick={() => setSmallDashboard(!smallDashboard)} > -

حسین معصومی پور

+

+ {profile?.firstName} {profile?.lastName} +

@@ -110,42 +115,44 @@ const Navbar = ({ theme }) => {
  • -
    -

    - داشبورد -

    -
    -
    + +
    +

    + داشبورد +

    +
    +
    +
  • -
    -

    - سفارشات -

    -
    -
    + +
    +

    + پیگیری سفارش +

    +
    +
    +
  • -
    -

    - پیگیری سفارش -

    -
    -
    + +
    +

    + آدرس ها{" "} +

    +
    +
    +
  • -
  • -
    -

    - پشتیبانی{" "} -

    -
    -
    -
  • - -
  • +
  • + CTX.setBottomSheetLogOutOpen(true) + } + >

    خروج{" "}

    @@ -348,11 +355,13 @@ const Navbar = ({ theme }) => {
- {1 == 2 ? ( + {profile?.length <= 0 ? (
-
- ورود / عضویت{" "} -
+ +
+ ورود / عضویت{" "} +
+
) : (
@@ -361,7 +370,9 @@ const Navbar = ({ theme }) => { className="bg-gray-100 py-2 px-3 rounded-xl text-sm flex cursor-pointer " onClick={() => setSmallDashboard(!smallDashboard)} > -

حسین معصومی پور

+

+ {profile?.firstName} {profile?.lastName} +

{" "}
{smallDashboard && ( @@ -376,42 +387,44 @@ const Navbar = ({ theme }) => {
  • -
    -

    - داشبورد -

    -
    -
    + +
    +

    + داشبورد +

    +
    +
    +
  • -
    -

    - سفارشات -

    -
    -
    + +
    +

    + پیگیری سفارش +

    +
    +
    +
  • -
    -

    - پیگیری سفارش -

    -
    -
    + +
    +

    + آدرس ها{" "} +

    +
    +
    +
  • -
  • -
    -

    - پشتیبانی{" "} -

    -
    -
    -
  • - -
  • +
  • + CTX.setBottomSheetLogOutOpen(true) + } + >

    خروج{" "}

    diff --git a/iranCities.js b/iranCities.js new file mode 100644 index 0000000..2228ad3 --- /dev/null +++ b/iranCities.js @@ -0,0 +1,2570 @@ +export const iranCities = () => { + return [ + { + id: 102, + title: "آبادان", + slug: "Abadan", + province_id: 7, + latitude: 32.9925, + longitude: 47.419722, + }, + { + id: 129, + title: "آباده", + slug: "Abade", + province_id: 8, + latitude: 30.347296, + longitude: 48.2934004, + }, + { + id: 296, + title: "آبدانان", + slug: "ABDANAN", + province_id: 17, + latitude: 32.9925, + longitude: 47.419722, + }, + { + id: 65, + title: "آذرشهر", + slug: "Azarshahr", + province_id: 4, + latitude: 37.758889, + longitude: 45.978333, + }, + { + id: 332, + title: "آرادان", + slug: "Aradan", + province_id: 21, + latitude: 33.860278, + longitude: 58.521667, + }, + { + id: 226, + title: "آران وبيدگل", + slug: "Aran va Bidgol", + province_id: 11, + latitude: 34.057778, + longitude: 51.484167, + }, + { + id: 400, + title: "آزادشهر", + slug: "Azadshahr", + province_id: 28, + latitude: 37.758889, + longitude: 45.978333, + }, + { + id: 13, + title: "آستارا", + slug: "Astara", + province_id: 2, + latitude: 38.429167, + longitude: 48.871944, + }, + { + id: 14, + title: "آستانه اشرفيه", + slug: "Astaneh", + province_id: 2, + latitude: 37.2598022, + longitude: 49.9436621, + }, + { + id: 2, + title: "آشتيان", + slug: "Ashtian", + province_id: 1, + latitude: 34.521944, + longitude: 50.006111, + }, + { + id: 398, + title: "آق قلا", + slug: "Aqqala", + province_id: 28, + latitude: 37.013889, + longitude: 54.455, + }, + { + id: 29, + title: "آمل", + slug: "Amol", + province_id: 3, + latitude: 36.469722, + longitude: 52.350833, + }, + { + id: 341, + title: "ابركوه", + slug: "Abarkouh", + province_id: 22, + latitude: 31.1304036, + longitude: 53.2503736, + }, + { + id: 319, + title: "ابهر", + slug: "Abhar", + province_id: 20, + latitude: 38.4894305, + longitude: 47.0683575, + }, + { + id: 345, + title: "ابوموسي", + slug: "Abu Musa", + province_id: 23, + latitude: 25.8797106, + longitude: 55.0328017, + }, + { + id: 1, + title: "اراک", + slug: "Arak", + province_id: 1, + latitude: 34.091667, + longitude: 49.689167, + }, + { + id: 374, + title: "اردبيل", + slug: "Ardabil", + province_id: 25, + latitude: 38.4853276, + longitude: 47.8911209, + }, + { + id: 209, + title: "اردستان", + slug: "Ardestān", + province_id: 11, + latitude: 33.376111, + longitude: 52.369444, + }, + { + id: 335, + title: "اردكان", + slug: "Ardakan", + province_id: 22, + latitude: 33.376111, + longitude: 52.369444, + }, + { + id: 275, + title: "اردل", + slug: "Ardal", + province_id: 15, + latitude: 38.4853276, + longitude: 47.8911209, + }, + { + id: 145, + title: "ارسنجان", + slug: "Arsanjan", + province_id: 8, + latitude: 33.376111, + longitude: 52.369444, + }, + { + id: 71, + title: "اروميه", + slug: "Address:", + province_id: 5, + latitude: 37.555278, + longitude: 45.0725, + }, + { + id: 286, + title: "ازنا", + slug: "AZNA", + province_id: 16, + latitude: 33.455833, + longitude: 49.455556, + }, + { + id: 130, + title: "استهبان", + slug: "Estahban", + province_id: 8, + latitude: 35.696111, + longitude: 51.423056, + }, + { + id: 267, + title: "اسدآباد", + slug: "Asadabad", + province_id: 14, + latitude: 37.85, + longitude: 46.833333, + }, + { + id: 405, + title: "اسفراين", + slug: "Esfaraien", + province_id: 29, + latitude: 37.076389, + longitude: 57.51, + }, + { + id: 88, + title: "اسلام آبادغرب", + slug: "Islamic garb", + province_id: 6, + latitude: 33.7293882, + longitude: 73.0931461, + }, + { + id: 364, + title: "اسلامشهر", + slug: "Eslamshahr", + province_id: 24, + latitude: 35.5445805, + longitude: 51.2302457, + }, + { + id: 66, + title: "اسکو", + slug: "Osku", + province_id: 4, + latitude: 37.915833, + longitude: 46.123611, + }, + { + id: 83, + title: "اشنويه", + slug: "Oshnavieh", + province_id: 5, + latitude: 37.039722, + longitude: 45.098333, + }, + { + id: 210, + title: "اصفهان", + slug: "Esfahan", + province_id: 11, + latitude: 32.6546275, + longitude: 51.6679826, + }, + { + id: 131, + title: "اقليد", + slug: "Eghlid", + province_id: 8, + latitude: 30.898889, + longitude: 52.686667, + }, + { + id: 389, + title: "البرز", + slug: "Alborz", + province_id: 27, + latitude: 35.9960467, + longitude: 50.9289246, + }, + { + id: 280, + title: "اليگودرز", + slug: "Aligoudarz", + province_id: 16, + latitude: 33.400556, + longitude: 49.695, + }, + { + id: 25, + title: "املش", + slug: "Amlash", + province_id: 2, + latitude: 37.0916334, + longitude: 50.1869377, + }, + { + id: 177, + title: "انار", + slug: "Pomegranate", + province_id: 9, + latitude: 37.340278, + longitude: 46.056111, + }, + { + id: 103, + title: "انديمشک", + slug: "ANDIMESHK", + province_id: 7, + latitude: 32.46, + longitude: 48.359167, + }, + { + id: 51, + title: "اهر", + slug: "Ahar", + province_id: 4, + latitude: 38.4894305, + longitude: 47.0683575, + }, + { + id: 104, + title: "اهواز", + slug: "Ahvaz", + province_id: 7, + latitude: 31.3183272, + longitude: 48.6706187, + }, + { + id: 322, + title: "ايجرود", + slug: "Ijroud", + province_id: 20, + latitude: 36.4160928, + longitude: 48.2469249, + }, + { + id: 105, + title: "ايذه", + slug: "IZEH", + province_id: 7, + latitude: 31.834167, + longitude: 49.867222, + }, + { + id: 233, + title: "ايرانشهر", + slug: "Iranshahr", + province_id: 12, + latitude: 36.694444, + longitude: 45.141667, + }, + { + id: 291, + title: "ايلام", + slug: "Ilam", + province_id: 17, + latitude: 33.2957618, + longitude: 46.670534, + }, + { + id: 297, + title: "ايوان", + slug: "Ivan", + province_id: 17, + latitude: 33.2729171, + longitude: 52.1985314, + }, + { + id: 30, + title: "بابل", + slug: "Babol", + province_id: 3, + latitude: 36.7025, + longitude: 52.6575, + }, + { + id: 39, + title: "بابلسر", + slug: "Babolsar", + province_id: 3, + latitude: 32.468191, + longitude: 44.5501935, + }, + { + id: 307, + title: "باشت", + slug: "Basht", + province_id: 18, + latitude: 29.233056, + longitude: 56.602222, + }, + { + id: 116, + title: "باغ ملک", + slug: "Garden Property", + province_id: 7, + latitude: 32.3947206, + longitude: 51.5965328, + }, + { + id: 158, + title: "بافت", + slug: "Tissue", + province_id: 9, + latitude: 29.233056, + longitude: 56.602222, + }, + { + id: 336, + title: "بافق", + slug: "Bafg", + province_id: 22, + latitude: 35.9985999, + longitude: 45.8823428, + }, + { + id: 252, + title: "بانه", + slug: "Bane", + province_id: 13, + latitude: 35.2747322, + longitude: 59.4677727, + }, + { + id: 125, + title: "باوي", + slug: "Bavi", + province_id: 7, + latitude: 35.2747322, + longitude: 59.4677727, + }, + { + id: 200, + title: "بجستان", + slug: "Bajestan", + province_id: 10, + latitude: 33.376111, + longitude: 52.369444, + }, + { + id: 406, + title: "بجنورد", + slug: "Bojnoord", + province_id: 29, + latitude: 37.475, + longitude: 57.333333, + }, + { + id: 230, + title: "برخوار", + slug: "Borkhar", + province_id: 11, + latitude: 34.974722, + longitude: 59.623611, + }, + { + id: 195, + title: "بردسكن", + slug: "Bardaskan", + province_id: 10, + latitude: 35.260833, + longitude: 57.969722, + }, + { + id: 167, + title: "بردسير", + slug: "Bardsir", + province_id: 9, + latitude: 29.9275, + longitude: 56.572222, + }, + { + id: 281, + title: "بروجرد", + slug: "Borujerd", + province_id: 16, + latitude: 37.475, + longitude: 57.333333, + }, + { + id: 271, + title: "بروجن", + slug: "Borujen", + province_id: 15, + latitude: 31.965278, + longitude: 51.287222, + }, + { + id: 59, + title: "بستان آباد", + slug: "Bostanabad", + province_id: 4, + latitude: 37.85, + longitude: 46.833333, + }, + { + id: 353, + title: "بستك", + slug: "Block", + province_id: 23, + latitude: 27.199167, + longitude: 54.366667, + }, + { + id: 159, + title: "بم", + slug: "Bass", + province_id: 9, + latitude: 29.106111, + longitude: 58.356944, + }, + { + id: 58, + title: "بناب", + slug: "BONAB", + province_id: 4, + latitude: 37.340278, + longitude: 46.056111, + }, + { + id: 15, + title: "بندرانزلي", + slug: "Bandar Anzali", + province_id: 2, + latitude: 37.4724467, + longitude: 49.4587312, + }, + { + id: 346, + title: "بندرعباس", + slug: "Bandar Abbas", + province_id: 23, + latitude: 35.952222, + longitude: 50.6075, + }, + { + id: 347, + title: "بندرلنگه", + slug: "Lengeh seaport", + province_id: 23, + latitude: 26.558056, + longitude: 54.880556, + }, + { + id: 106, + title: "بندرماهشهر", + slug: "Bandar-e Mahshahr", + province_id: 7, + latitude: 33.139722, + longitude: 47.376111, + }, + { + id: 391, + title: "بندرگز", + slug: "Gaz", + province_id: 28, + latitude: 37.444444, + longitude: 59.108056, + }, + { + id: 344, + title: "بهاباد", + slug: "Bahabad", + province_id: 22, + latitude: 36.763056, + longitude: 45.722222, + }, + { + id: 268, + title: "بهار", + slug: "Spring", + province_id: 14, + latitude: 37.340278, + longitude: 46.056111, + }, + { + id: 371, + title: "بهارستان", + slug: "BAHARESTAN", + province_id: 24, + latitude: 33.376111, + longitude: 52.369444, + }, + { + id: 107, + title: "بهبهان", + slug: "PA", + province_id: 7, + latitude: 30.595833, + longitude: 50.241667, + }, + { + id: 31, + title: "بهشهر", + slug: "Behshahr", + province_id: 3, + latitude: 34.9083252, + longitude: 48.4392729, + }, + { + id: 305, + title: "بهمئي", + slug: "Bahmaie", + province_id: 18, + latitude: 0, + longitude: 0, + }, + { + id: 385, + title: "بوئين زهرا", + slug: "Buin Zahra", + province_id: 27, + latitude: 35.766944, + longitude: 50.057778, + }, + { + id: 144, + title: "بوانات", + slug: "Bavanat", + province_id: 8, + latitude: 33.220556, + longitude: 50.315, + }, + { + id: 309, + title: "بوشهر", + slug: "Bushehr", + province_id: 19, + latitude: 28.9233837, + longitude: 50.820314, + }, + { + id: 80, + title: "بوكان", + slug: "Bukan", + province_id: 5, + latitude: 36.521111, + longitude: 46.208889, + }, + { + id: 301, + title: "بويراحمد", + slug: "Boyer", + province_id: 18, + latitude: 30.724586, + longitude: 50.8456323, + }, + { + id: 253, + title: "بيجار", + slug: "Bijar", + province_id: 13, + latitude: 32.735278, + longitude: 59.466667, + }, + { + id: 413, + title: "بيرجند", + slug: "Birjand", + province_id: 30, + latitude: 32.8649039, + longitude: 59.2262472, + }, + { + id: 375, + title: "بيله سوار", + slug: "Bilesavar", + province_id: 25, + latitude: 39.3567775, + longitude: 47.9490765, + }, + { + id: 386, + title: "تاكستان", + slug: "The vineyard", + province_id: 27, + latitude: 28.9837547, + longitude: 50.8330708, + }, + { + id: 181, + title: "تايباد", + slug: "Taybad", + province_id: 10, + latitude: 34.74, + longitude: 60.775556, + }, + { + id: 52, + title: "تبريز", + slug: "Tabriz", + province_id: 4, + latitude: 38.066667, + longitude: 46.3, + }, + { + id: 183, + title: "تربت جام", + slug: "Torbat-e Jam", + province_id: 10, + latitude: 35.243889, + longitude: 60.6225, + }, + { + id: 182, + title: "تربت حيدريه", + slug: "Torbat", + province_id: 10, + latitude: 35.273889, + longitude: 59.219444, + }, + { + id: 337, + title: "تفت", + slug: "Taft", + province_id: 22, + latitude: 39.630631, + longitude: -78.929542, + }, + { + id: 3, + title: "تفرش", + slug: "Tafresh", + province_id: 1, + latitude: 34.691944, + longitude: 50.013056, + }, + { + id: 82, + title: "تكاب", + slug: "Tekab", + province_id: 5, + latitude: 37.340278, + longitude: 46.056111, + }, + { + id: 32, + title: "تنكابن", + slug: "Tonkabon", + province_id: 3, + latitude: 36.816389, + longitude: 50.873889, + }, + { + id: 310, + title: "تنگستان", + slug: "Tangistan", + province_id: 19, + latitude: 28.9837547, + longitude: 50.8330708, + }, + { + id: 358, + title: "تهران", + slug: "Tehran", + province_id: 24, + latitude: 31.94, + longitude: 51.647778, + }, + { + id: 262, + title: "تويسركان", + slug: "Tuyserkan", + province_id: 14, + latitude: 34.548056, + longitude: 48.446944, + }, + { + id: 227, + title: "تيران وکرون", + slug: "Tiran Vkrvn", + province_id: 11, + latitude: 0, + longitude: 0, + }, + { + id: 99, + title: "ثلاث باباجاني", + slug: "Salas Babajani", + province_id: 6, + latitude: 34.7358371, + longitude: 46.1493969, + }, + { + id: 407, + title: "جاجرم", + slug: "Jajarm", + province_id: 29, + latitude: 36.95, + longitude: 56.38, + }, + { + id: 350, + title: "جاسك", + slug: "Jask", + province_id: 23, + latitude: 25.643889, + longitude: 57.774444, + }, + { + id: 203, + title: "جغتاي", + slug: "Jaghatay", + province_id: 10, + latitude: 36.5788853, + longitude: 57.251215, + }, + { + id: 63, + title: "جلفا", + slug: "Jolfa", + province_id: 4, + latitude: 38.940278, + longitude: 45.630833, + }, + { + id: 317, + title: "جم", + slug: "Jam", + province_id: 19, + latitude: 27.827778, + longitude: 52.326944, + }, + { + id: 132, + title: "جهرم", + slug: "Jahrom", + province_id: 8, + latitude: 28.5, + longitude: 53.560556, + }, + { + id: 96, + title: "جوانرود", + slug: "Javanrood", + province_id: 6, + latitude: 36.418056, + longitude: 54.976389, + }, + { + id: 43, + title: "جويبار", + slug: "Juybar", + province_id: 3, + latitude: 36.8241289, + longitude: 49.4237274, + }, + { + id: 205, + title: "جوين", + slug: "Jovin", + province_id: 10, + latitude: 36.6362238, + longitude: 57.5079912, + }, + { + id: 160, + title: "جيرفت", + slug: "Jiroft", + province_id: 9, + latitude: 28.6751124, + longitude: 57.7371569, + }, + { + id: 352, + title: "حاجي اباد", + slug: "Hajiabadi", + province_id: 23, + latitude: 28.309167, + longitude: 55.901667, + }, + { + id: 343, + title: "خاتم", + slug: "Seal", + province_id: 22, + latitude: 28.1804287, + longitude: 55.7453367, + }, + { + id: 235, + title: "خاش", + slug: "Khash", + province_id: 12, + latitude: 28.216667, + longitude: 61.2, + }, + { + id: 320, + title: "خدابنده", + slug: "Khodabande", + province_id: 20, + latitude: 36.114722, + longitude: 48.591111, + }, + { + id: 282, + title: "خرم آباد", + slug: "Khorramabad", + province_id: 16, + latitude: 39.648333, + longitude: 47.9175, + }, + { + id: 146, + title: "خرم بيد", + slug: "Khorrambid", + province_id: 8, + latitude: 32.6708345, + longitude: 51.6470279, + }, + { + id: 323, + title: "خرمدره", + slug: "Khoramdeh", + province_id: 20, + latitude: 30.4256219, + longitude: 48.1891185, + }, + { + id: 108, + title: "خرمشهر", + slug: "Khorramshahr", + province_id: 7, + latitude: 37.758889, + longitude: 45.978333, + }, + { + id: 376, + title: "خلخال", + slug: "Anklet", + province_id: 25, + latitude: 37.618889, + longitude: 48.525833, + }, + { + id: 198, + title: "خليل آباد", + slug: "Khaliabad", + province_id: 10, + latitude: 35.255833, + longitude: 58.286389, + }, + { + id: 354, + title: "خمير", + slug: "Dough", + province_id: 23, + latitude: 26.952222, + longitude: 55.585, + }, + { + id: 4, + title: "خمين", + slug: "Khomain", + province_id: 1, + latitude: 33.6406148, + longitude: 50.0771125, + }, + { + id: 211, + title: "خميني شهر", + slug: "Khomeini Shahr", + province_id: 11, + latitude: 32.700278, + longitude: 51.521111, + }, + { + id: 152, + title: "خنج", + slug: "Khonj", + province_id: 8, + latitude: 27.891389, + longitude: 53.434444, + }, + { + id: 11, + title: "خنداب", + slug: "Varkaroud", + province_id: 1, + latitude: 37.340278, + longitude: 46.056111, + }, + { + id: 192, + title: "خواف", + slug: "KHAF", + province_id: 10, + latitude: 34.576389, + longitude: 60.140833, + }, + { + id: 212, + title: "خوانسار", + slug: "Khansar", + province_id: 11, + latitude: 33.220556, + longitude: 50.315, + }, + { + id: 422, + title: "خوسف", + slug: "Khoosf", + province_id: 30, + latitude: 34.576389, + longitude: 60.140833, + }, + { + id: 133, + title: "داراب", + slug: "Darab", + province_id: 8, + latitude: 37.940833, + longitude: 47.536667, + }, + { + id: 100, + title: "دالاهو", + slug: "Dalahoo", + province_id: 6, + latitude: 34.284167, + longitude: 46.242222, + }, + { + id: 327, + title: "دامغان", + slug: "Damghan", + province_id: 21, + latitude: 31.94, + longitude: 51.647778, + }, + { + id: 208, + title: "داورزن", + slug: "Davarzan", + province_id: 10, + latitude: 36.168333, + longitude: 54.348056, + }, + { + id: 414, + title: "درميان", + slug: "in the middle of", + province_id: 30, + latitude: 33.0339405, + longitude: 60.1184797, + }, + { + id: 292, + title: "دره شهر", + slug: "Valley City", + province_id: 17, + latitude: 33.139722, + longitude: 47.376111, + }, + { + id: 184, + title: "درگز", + slug: "Dargaz", + province_id: 10, + latitude: 37.444444, + longitude: 59.108056, + }, + { + id: 109, + title: "دزفول", + slug: "Dezful", + province_id: 7, + latitude: 32.3830777, + longitude: 48.4235841, + }, + { + id: 110, + title: "دشت آزادگان", + slug: "DashteAzadegan", + province_id: 7, + latitude: 30.347296, + longitude: 48.2934004, + }, + { + id: 311, + title: "دشتستان", + slug: "Dashtestan", + province_id: 19, + latitude: 29.266667, + longitude: 51.216667, + }, + { + id: 312, + title: "دشتي", + slug: "Dashti", + province_id: 19, + latitude: 35.7845145, + longitude: 51.4347961, + }, + { + id: 283, + title: "دلفان", + slug: "Delfan", + province_id: 16, + latitude: 38.940278, + longitude: 45.630833, + }, + { + id: 5, + title: "دليجان", + slug: "Delijan", + province_id: 1, + latitude: 32.4750168, + longitude: 51.3050851, + }, + { + id: 244, + title: "دلگان", + slug: "Dlgan", + province_id: 12, + latitude: 27.6077357, + longitude: 59.4720904, + }, + { + id: 359, + title: "دماوند", + slug: "Damavand", + province_id: 24, + latitude: 35.9467494, + longitude: 52.1275481, + }, + { + id: 304, + title: "دنا", + slug: "Dena", + province_id: 18, + latitude: 30.9516666, + longitude: 51.4375, + }, + { + id: 229, + title: "دهاقان", + slug: "Dehaghan", + province_id: 11, + latitude: 31.94, + longitude: 51.647778, + }, + { + id: 293, + title: "دهلران", + slug: "DEHLORAN", + province_id: 17, + latitude: 31.94, + longitude: 51.647778, + }, + { + id: 261, + title: "دهگلان", + slug: "Dehgolan", + province_id: 13, + latitude: 31.94, + longitude: 51.647778, + }, + { + id: 289, + title: "دوره", + slug: "the period", + province_id: 16, + latitude: 33.4955028, + longitude: 49.0631743, + }, + { + id: 284, + title: "دورود", + slug: "Dorud", + province_id: 16, + latitude: 34.806667, + longitude: 46.488611, + }, + { + id: 316, + title: "ديلم", + slug: "Daylam", + province_id: 19, + latitude: 30.1182632, + longitude: 50.2261227, + }, + { + id: 258, + title: "ديواندره", + slug: "Divandareh", + province_id: 13, + latitude: 35.913889, + longitude: 47.023889, + }, + { + id: 175, + title: "رابر", + slug: "Seal", + province_id: 9, + latitude: 37.940833, + longitude: 47.536667, + }, + { + id: 33, + title: "رامسر", + slug: "Ramsar", + province_id: 3, + latitude: 36.903056, + longitude: 50.658333, + }, + { + id: 120, + title: "رامشير", + slug: "Ramshir", + province_id: 7, + latitude: 30.4256219, + longitude: 48.1891185, + }, + { + id: 111, + title: "رامهرمز", + slug: "Rāmhormoz", + province_id: 7, + latitude: 31.28, + longitude: 49.603611, + }, + { + id: 401, + title: "راميان", + slug: "Ramian", + province_id: 28, + latitude: 33.2729171, + longitude: 52.1985314, + }, + { + id: 168, + title: "راور", + slug: "Raver", + province_id: 9, + latitude: 31.265556, + longitude: 56.805556, + }, + { + id: 365, + title: "رباطكريم", + slug: "Robat Karim", + province_id: 24, + latitude: 35.484722, + longitude: 51.082778, + }, + { + id: 269, + title: "رزن", + slug: "Razan", + province_id: 14, + latitude: 35.386667, + longitude: 49.033889, + }, + { + id: 154, + title: "رستم", + slug: "Rustam", + province_id: 8, + latitude: 37.2709152, + longitude: 49.5969146, + }, + { + id: 17, + title: "رشت", + slug: "Rasht", + province_id: 2, + latitude: 37.280833, + longitude: 49.583056, + }, + { + id: 196, + title: "رشتخوار", + slug: "Roshtkhar", + province_id: 10, + latitude: 34.974722, + longitude: 59.623611, + }, + { + id: 26, + title: "رضوانشهر", + slug: "Rezvanshahr", + province_id: 2, + latitude: 36.694444, + longitude: 45.141667, + }, + { + id: 161, + title: "رفسنجان", + slug: "Rafsanjan", + province_id: 9, + latitude: 32.4750168, + longitude: 51.3050851, + }, + { + id: 101, + title: "روانسر", + slug: "Rawansar", + province_id: 6, + latitude: 33.220556, + longitude: 50.315, + }, + { + id: 18, + title: "رودبار", + slug: "Rudbar", + province_id: 2, + latitude: 36.641111, + longitude: 52.9125, + }, + { + id: 172, + title: "رودبارجنوب", + slug: "Rvdbarjnvb", + province_id: 9, + latitude: 36.8241289, + longitude: 49.4237274, + }, + { + id: 19, + title: "رودسر", + slug: "Rudsar", + province_id: 2, + latitude: 37.1378415, + longitude: 50.2836199, + }, + { + id: 290, + title: "رومشکان", + slug: "Rvmshkan", + province_id: 16, + latitude: 36.521111, + longitude: 46.208889, + }, + { + id: 174, + title: "ريگان", + slug: "Reagan", + province_id: 9, + latitude: 27.6077357, + longitude: 59.4720904, + }, + { + id: 236, + title: "زابل", + slug: "Zabul", + province_id: 12, + latitude: 31.028611, + longitude: 61.501111, + }, + { + id: 237, + title: "زاهدان", + slug: "Zahedan", + province_id: 12, + latitude: 30.347296, + longitude: 48.2934004, + }, + { + id: 204, + title: "زاوه", + slug: "Zavh", + province_id: 10, + latitude: 35.2747322, + longitude: 59.4677727, + }, + { + id: 162, + title: "زرند", + slug: "Zarand", + province_id: 9, + latitude: 38.425117, + longitude: 45.769636, + }, + { + id: 9, + title: "زرنديه", + slug: "Zarandieh", + province_id: 1, + latitude: 30.812778, + longitude: 56.563889, + }, + { + id: 147, + title: "زرين دشت", + slug: "Zarrindasht", + province_id: 8, + latitude: 28.3545047, + longitude: 54.4178006, + }, + { + id: 321, + title: "زنجان", + slug: "Zanjan", + province_id: 20, + latitude: 32.4750168, + longitude: 51.3050851, + }, + { + id: 421, + title: "زيرکوه", + slug: "Zirkouh", + province_id: 30, + latitude: 31.1304036, + longitude: 53.2503736, + }, + { + id: 34, + title: "سارئ", + slug: "Infectious", + province_id: 3, + latitude: 36.563333, + longitude: 53.06, + }, + { + id: 278, + title: "سامان", + slug: "Order", + province_id: 15, + latitude: 31.94, + longitude: 51.647778, + }, + { + id: 425, + title: "ساوجبلاغ", + slug: "Savojbolagh", + province_id: 31, + latitude: 38.3787941, + longitude: 47.4974359, + }, + { + id: 6, + title: "ساوه", + slug: "Saveh", + province_id: 1, + latitude: 35.2747322, + longitude: 59.4677727, + }, + { + id: 185, + title: "سبزوار", + slug: "Sabzevar", + province_id: 10, + latitude: 36.2151823, + longitude: 57.6678228, + }, + { + id: 53, + title: "سراب", + slug: "Sarab", + province_id: 4, + latitude: 37.940833, + longitude: 47.536667, + }, + { + id: 238, + title: "سراوان", + slug: "Saravan", + province_id: 12, + latitude: 33.860278, + longitude: 58.521667, + }, + { + id: 418, + title: "سرايان", + slug: "Writers", + province_id: 30, + latitude: 33.860278, + longitude: 58.521667, + }, + { + id: 240, + title: "سرباز", + slug: "Soldier", + province_id: 12, + latitude: 37.940833, + longitude: 47.536667, + }, + { + id: 415, + title: "سربيشه", + slug: "Sarbishe", + province_id: 30, + latitude: 32.575556, + longitude: 59.798333, + }, + { + id: 193, + title: "سرخس", + slug: "Fern", + province_id: 10, + latitude: 37.940833, + longitude: 47.536667, + }, + { + id: 334, + title: "سرخه", + slug: "Sorkhe", + province_id: 21, + latitude: 36.545, + longitude: 61.157778, + }, + { + id: 74, + title: "سردشت", + slug: "Sardasht", + province_id: 5, + latitude: 36.155278, + longitude: 45.478889, + }, + { + id: 260, + title: "سروآباد", + slug: "Sarvabad", + province_id: 13, + latitude: 37.85, + longitude: 46.833333, + }, + { + id: 153, + title: "سروستان", + slug: "Sarvestan", + province_id: 8, + latitude: 33.376111, + longitude: 52.369444, + }, + { + id: 91, + title: "سرپل ذهاب", + slug: "Sarpolzohab", + province_id: 6, + latitude: 34.461111, + longitude: 45.862778, + }, + { + id: 254, + title: "سقز", + slug: "Turpentine", + province_id: 13, + latitude: 36.246389, + longitude: 46.266389, + }, + { + id: 288, + title: "سلسله", + slug: "Series", + province_id: 16, + latitude: 32.045776, + longitude: 34.751639, + }, + { + id: 75, + title: "سلماس", + slug: "Salmas", + province_id: 5, + latitude: 38.197222, + longitude: 44.765278, + }, + { + id: 328, + title: "سمنان", + slug: "Semnan", + province_id: 21, + latitude: 35.2255585, + longitude: 54.4342138, + }, + { + id: 213, + title: "سميرم", + slug: "Semirom", + province_id: 11, + latitude: 31.3988346, + longitude: 51.567593, + }, + { + id: 92, + title: "سنقر", + slug: "Falcon", + province_id: 6, + latitude: 34.783611, + longitude: 47.600278, + }, + { + id: 255, + title: "سنندج", + slug: "Sanandaj", + province_id: 13, + latitude: 35.3218748, + longitude: 46.9861647, + }, + { + id: 35, + title: "سوادكوه", + slug: "Savadkooh", + province_id: 3, + }, + { + id: 163, + title: "سيرجان", + slug: "Sirjan", + province_id: 9, + }, + { + id: 299, + title: "سيروان", + slug: "Sirvan", + province_id: 17, + }, + { + id: 134, + title: "سپيدان", + slug: "Sepidan", + province_id: 8, + }, + { + id: 112, + title: "شادگان", + slug: "Shadegan", + province_id: 7, + }, + { + id: 7, + title: "شازند", + slug: "Shazand", + province_id: 1, + }, + { + id: 329, + title: "شاهرود", + slug: "Anymore", + province_id: 21, + }, + { + id: 81, + title: "شاهين دژ", + slug: "Shahindezh", + province_id: 5, + }, + { + id: 224, + title: "شاهين شهروميمه", + slug: "Shahin Shhrvmymh", + province_id: 11, + }, + { + id: 60, + title: "شبستر", + slug: "Shabestar", + province_id: 4, + }, + { + id: 24, + title: "شفت", + slug: "Shafts", + province_id: 2, + }, + { + id: 361, + title: "شميرانات", + slug: "Shemiranat", + province_id: 24, + }, + { + id: 164, + title: "شهربابك", + slug: "Shahrbabak", + province_id: 9, + }, + { + id: 217, + title: "شهرضا", + slug: "Branch", + province_id: 11, + }, + { + id: 272, + title: "شهركرد", + slug: "Kord", + province_id: 15, + }, + { + id: 363, + title: "شهريار", + slug: "Sh.", + province_id: 24, + }, + { + id: 115, + title: "شوش", + slug: "Susa", + province_id: 7, + }, + { + id: 113, + title: "شوشتر", + slug: "Shushtar", + province_id: 7, + }, + { + id: 87, + title: "شوط", + slug: "Round", + province_id: 5, + }, + { + id: 135, + title: "شيراز", + slug: "Shiraz", + province_id: 8, + }, + { + id: 408, + title: "شيروان", + slug: "Shirvan", + province_id: 29, + }, + { + id: 97, + title: "صحنه", + slug: "Scene", + province_id: 6, + }, + { + id: 20, + title: "صومعه سرا", + slug: "Somesara", + province_id: 2, + }, + { + id: 324, + title: "طارم", + slug: "Tarom", + province_id: 20, + }, + { + id: 427, + title: "طالقان", + slug: "Taleghan", + province_id: 31, + }, + { + id: 423, + title: "طبس", + slug: "Peaks", + province_id: 30, + }, + { + id: 16, + title: "طوالش", + slug: "Tvalsh", + province_id: 2, + }, + { + id: 46, + title: "عباس آباد", + slug: "Abbas Abad", + province_id: 3, + }, + { + id: 69, + title: "عجب شير", + slug: "Ajabshir", + province_id: 4, + }, + { + id: 393, + title: "علي آباد", + slug: "Ali Abad", + province_id: 28, + }, + { + id: 169, + title: "عنبرآباد", + slug: "Anbarabad", + province_id: 9, + }, + { + id: 273, + title: "فارسان", + slug: "Farsan", + province_id: 15, + }, + { + id: 409, + title: "فاروج", + slug: "Faruj", + province_id: 29, + }, + { + id: 150, + title: "فراشبند", + slug: "Farashband", + province_id: 8, + }, + { + id: 12, + title: "فراهان", + slug: "FARAHAN", + province_id: 1, + }, + { + id: 419, + title: "فردوس", + slug: "Paradise", + province_id: 30, + }, + { + id: 429, + title: "فرديس", + slug: "Fardis", + province_id: 31, + }, + { + id: 214, + title: "فريدن", + slug: "Frieden", + province_id: 11, + }, + { + id: 215, + title: "فريدونشهر", + slug: "Fereidunshahr", + province_id: 11, + }, + { + id: 45, + title: "فريدونكنار", + slug: "Fereidoon'kenar", + province_id: 3, + }, + { + id: 194, + title: "فريمان", + slug: "FARIMAN", + province_id: 10, + }, + { + id: 136, + title: "فسا", + slug: "Fasa", + province_id: 8, + }, + { + id: 216, + title: "فلاورجان", + slug: "Falavarjan", + province_id: 11, + }, + { + id: 251, + title: "فنوج", + slug: "Fenouj", + province_id: 12, + }, + { + id: 21, + title: "فومن", + slug: "Fooman", + province_id: 2, + }, + { + id: 137, + title: "فيروزآباد", + slug: "Firozabad", + province_id: 8, + }, + { + id: 367, + title: "فيروزكوه", + slug: "Firouzkouh", + province_id: 24, + }, + { + id: 36, + title: "قائم شهر", + slug: "Qaemshahr", + province_id: 3, + }, + { + id: 416, + title: "قائنات", + slug: "Ghaenat", + province_id: 30, + }, + { + id: 256, + title: "قروه", + slug: "Qorveh", + province_id: 13, + }, + { + id: 387, + title: "قزوين", + slug: "Qazvin", + province_id: 27, + }, + { + id: 348, + title: "قشم", + slug: "Qeshm", + province_id: 23, + }, + { + id: 93, + title: "قصرشيرين", + slug: "Qasr-e Shirin", + province_id: 6, + }, + { + id: 173, + title: "قلعه گنج", + slug: "Castle treasure", + province_id: 9, + }, + { + id: 384, + title: "قم", + slug: "Qom", + province_id: 26, + }, + { + id: 186, + title: "قوچان", + slug: "Ghoochan", + province_id: 10, + }, + { + id: 148, + title: "قيروکارزين", + slug: "Qyrvkarzyn", + province_id: 8, + }, + { + id: 187, + title: "كاشمر", + slug: "Kashmar", + province_id: 10, + }, + { + id: 259, + title: "كامياران", + slug: "Kamyaran", + province_id: 13, + }, + { + id: 266, + title: "كبودرآهنگ", + slug: "Kaboudarahang", + province_id: 14, + }, + { + id: 165, + title: "كرمان", + slug: "Kerman", + province_id: 9, + }, + { + id: 197, + title: "كلات", + slug: "Kalat", + province_id: 10, + }, + { + id: 399, + title: "كلاله", + slug: "Stigma", + province_id: 28, + }, + { + id: 314, + title: "كنگان", + slug: "Kangan", + province_id: 19, + }, + { + id: 166, + title: "كهنوج", + slug: "Kahnooj", + province_id: 9, + }, + { + id: 380, + title: "كوثر", + slug: "Kosar", + province_id: 25, + }, + { + id: 171, + title: "كوهبنان", + slug: "Kuhbanan", + province_id: 9, + }, + { + id: 276, + title: "كوهرنگ", + slug: "Kouhrang", + province_id: 15, + }, + { + id: 139, + title: "لارستان", + slug: "LARESTAN", + province_id: 8, + }, + { + id: 118, + title: "لالي", + slug: "Lali", + province_id: 7, + }, + { + id: 143, + title: "لامرد", + slug: "Lamerd", + province_id: 8, + }, + { + id: 23, + title: "لاهيجان", + slug: "LAHIJAN", + province_id: 2, + }, + { + id: 274, + title: "لردگان", + slug: "LORDEGAN", + province_id: 15, + }, + { + id: 220, + title: "لنجان", + slug: "Lenjan", + province_id: 11, + }, + { + id: 308, + title: "لنده", + slug: "Landhi", + province_id: 18, + }, + { + id: 22, + title: "لنگرود", + slug: "Langerud", + province_id: 2, + }, + { + id: 28, + title: "ماسال", + slug: "Masal", + province_id: 2, + }, + { + id: 76, + title: "ماكو", + slug: "Maku", + province_id: 5, + }, + { + id: 410, + title: "مانه وسملقان", + slug: "Manet Vsmlqan", + province_id: 29, + }, + { + id: 325, + title: "ماهنشان", + slug: "Mahneshan", + province_id: 20, + }, + { + id: 225, + title: "مبارکه", + slug: "Mobarakeh", + province_id: 11, + }, + { + id: 8, + title: "محلات", + slug: "Mahalat", + province_id: 1, + }, + { + id: 40, + title: "محمودآباد", + slug: "Mahmudabad", + province_id: 3, + }, + { + id: 54, + title: "مراغه", + slug: "Maragheh", + province_id: 4, + }, + { + id: 55, + title: "مرند", + slug: "Marand", + province_id: 4, + }, + { + id: 140, + title: "مرودشت", + slug: "MARVDASHT", + province_id: 8, + }, + { + id: 257, + title: "مريوان", + slug: "Marivan", + province_id: 13, + }, + { + id: 114, + title: "مسجدسليمان", + slug: "Masjed Soleiman", + province_id: 7, + }, + { + id: 189, + title: "مشهد", + slug: "Mashhad", + province_id: 10, + }, + { + id: 377, + title: "مشگين شهر", + slug: "Meshkinshar", + province_id: 25, + }, + { + id: 369, + title: "ملارد", + slug: "Mallard", + province_id: 24, + }, + { + id: 263, + title: "ملاير", + slug: "Malayer", + province_id: 14, + }, + { + id: 64, + title: "ملکان", + slug: "Malakan", + province_id: 4, + }, + { + id: 141, + title: "ممسني", + slug: "Mamasani", + province_id: 8, + }, + { + id: 170, + title: "منوجان", + slug: "Manoujan", + province_id: 9, + }, + { + id: 199, + title: "مه ولات", + slug: "Mahvelat", + province_id: 10, + }, + { + id: 77, + title: "مهاباد", + slug: "Mahabad", + province_id: 5, + }, + { + id: 331, + title: "مهدئ شهر", + slug: "Mehdi City", + province_id: 21, + }, + { + id: 149, + title: "مهر", + slug: "stamp", + province_id: 8, + }, + { + id: 295, + title: "مهران", + slug: "Mehran", + province_id: 17, + }, + { + id: 245, + title: "مهرستان", + slug: "Your spouse", + province_id: 12, + }, + { + id: 338, + title: "مهريز", + slug: "MEHRIZ", + province_id: 22, + }, + { + id: 78, + title: "مياندوآب", + slug: "Miandoab", + province_id: 5, + }, + { + id: 56, + title: "ميانه", + slug: "Mianeh", + province_id: 4, + }, + { + id: 340, + title: "ميبد", + slug: "Meibod", + province_id: 22, + }, + { + id: 349, + title: "ميناب", + slug: "Minab", + province_id: 23, + }, + { + id: 397, + title: "مينودشت", + slug: "Minoodasht", + province_id: 28, + }, + { + id: 222, + title: "نجف آباد", + slug: "Najaf Abad", + province_id: 11, + }, + { + id: 178, + title: "نرماشير", + slug: "Narmashir", + province_id: 9, + }, + { + id: 223, + title: "نطنز", + slug: "Natanz", + province_id: 11, + }, + { + id: 426, + title: "نظرآباد", + slug: "Nazarabad", + province_id: 31, + }, + { + id: 79, + title: "نقده", + slug: "Tinsel", + province_id: 5, + }, + { + id: 381, + title: "نمين", + slug: "Namin", + province_id: 25, + }, + { + id: 264, + title: "نهاوند", + slug: "Skinheads", + province_id: 14, + }, + { + id: 417, + title: "نهبندان", + slug: "Nehbandan", + province_id: 30, + }, + { + id: 37, + title: "نور", + slug: "Nur", + province_id: 3, + }, + { + id: 38, + title: "نوشهر", + slug: "Noshahr", + province_id: 3, + }, + { + id: 382, + title: "نير", + slug: "Nir", + province_id: 25, + }, + { + id: 190, + title: "نيشابور", + slug: "Neyshabur", + province_id: 10, + }, + { + id: 239, + title: "نيك شهر", + slug: "Nikshahr", + province_id: 12, + }, + { + id: 98, + title: "هرسين", + slug: "Harsin", + province_id: 6, + }, + { + id: 62, + title: "هريس", + slug: "Harris", + province_id: 4, + }, + { + id: 57, + title: "هشترود", + slug: "Hashtrood", + province_id: 4, + }, + { + id: 265, + title: "همدان", + slug: "Hamedan", + province_id: 14, + }, + { + id: 119, + title: "هنديجان", + slug: "Hendijan", + province_id: 7, + }, + { + id: 362, + title: "ورامين", + slug: "Varamin", + province_id: 24, + }, + { + id: 68, + title: "ورزقان", + slug: "Varzeghan", + province_id: 4, + }, + { + id: 379, + title: "پارس آباد", + slug: "Pars Abad", + province_id: 25, + }, + { + id: 355, + title: "پارسيان", + slug: "Parsian", + province_id: 23, + }, + { + id: 151, + title: "پاسارگاد", + slug: "Pasargad", + province_id: 8, + }, + { + id: 366, + title: "پاكدشت", + slug: "Pakdasht", + province_id: 24, + }, + { + id: 90, + title: "پاوه", + slug: "Pave", + province_id: 6, + }, + { + id: 372, + title: "پرديس", + slug: "College", + province_id: 24, + }, + { + id: 287, + title: "پلدختر", + slug: "Poldokhtar", + province_id: 16, + }, + { + id: 85, + title: "پلدشت", + slug: "Demands", + province_id: 5, + }, + { + id: 72, + title: "پيرانشهر", + slug: "Piranshar", + province_id: 5, + }, + { + id: 228, + title: "چادگان", + slug: "Chadegan", + province_id: 11, + }, + { + id: 67, + title: "چاراويماق", + slug: "Charoymagh", + province_id: 4, + }, + { + id: 84, + title: "چالدران", + slug: "Chalderan", + province_id: 5, + }, + { + id: 42, + title: "چالوس", + slug: "Chalus", + province_id: 3, + }, + { + id: 234, + title: "چابهار", + slug: "ChaBahar", + province_id: 12, + }, + { + id: 191, + title: "چناران", + slug: "CHENARAN", + province_id: 10, + }, + { + id: 128, + title: "کارون", + slug: "Karun", + province_id: 7, + }, + { + id: 138, + title: "کازرون", + slug: "Kazeroon", + province_id: 8, + }, + { + id: 218, + title: "کاشان", + slug: "Kashan", + province_id: 11, + }, + { + id: 424, + title: "کرج", + slug: "Karaj", + province_id: 31, + }, + { + id: 89, + title: "کرمانشاه", + slug: "Kermanshah", + province_id: 6, + }, + { + id: 50, + title: "کلاردشت", + slug: "Kelardasht", + province_id: 3, + }, + { + id: 61, + title: "کليبر", + slug: "Kalibar", + province_id: 4, + }, + { + id: 10, + title: "کميجان", + slug: "Komijan", + province_id: 1, + }, + { + id: 94, + title: "کنگاور", + slug: "Kangavar", + province_id: 6, + }, + { + id: 156, + title: "کوار", + slug: "Kovar", + province_id: 8, + }, + { + id: 285, + title: "کوهدشت", + slug: "Kuhdasht", + province_id: 16, + }, + { + id: 121, + title: "گتوند", + slug: "Scroll down", + province_id: 7, + }, + { + id: 330, + title: "گرمسار", + slug: "Garmsar", + province_id: 21, + }, + { + id: 411, + title: "گرمه", + slug: "it is hot", + province_id: 29, + }, + { + id: 378, + title: "گرمي", + slug: "G", + province_id: 25, + }, + { + id: 395, + title: "گرگان", + slug: "Gorgan", + province_id: 2, + }, + { + id: 44, + title: "گلوگاه", + slug: "Galugah", + province_id: 3, + }, + { + id: 219, + title: "گلپايگان", + slug: "Golpaygan", + province_id: 11, + }, + { + id: 188, + title: "گناباد", + slug: "GONABAD", + province_id: 10, + }, + { + id: 315, + title: "گناوه", + slug: "Ganaveh", + province_id: 19, + }, + { + id: 396, + title: "گنبدكاووس", + slug: "Gonbad", + province_id: 28, + }, + { + id: 95, + title: "گيلانغرب", + slug: "Gilangharb", + province_id: 6, + }, + { + id: 303, + title: "گچساران", + slug: "Gachsaran", + province_id: 18, + }, + ]; +}; diff --git a/iranProvince.js b/iranProvince.js new file mode 100644 index 0000000..5c47f30 --- /dev/null +++ b/iranProvince.js @@ -0,0 +1,221 @@ +export const iranProvince = () => { + return [ + { + id: 4, + title: "آذربايجان شرقي", + slug: "East Azarbaijan", + latitude: 37.9035733, + longitude: 46.2682109, + }, + { + id: 5, + title: "آذربايجان غربي", + slug: "Western Azerbaijan", + latitude: 37.9035733, + longitude: 46.2682109, + }, + { + id: 25, + title: "اردبيل", + slug: "Ardabil", + latitude: 38.4853276, + longitude: 47.8911209, + }, + { + id: 11, + title: "اصفهان", + slug: "Esfahan", + latitude: 32.6546275, + longitude: 51.6679826, + }, + { + id: 31, + title: "البرز", + slug: "Alborz", + latitude: 35.9960467, + longitude: 50.9289246, + }, + { + id: 17, + title: "ايلام", + slug: "Ilam", + latitude: 33.2957618, + longitude: 46.670534, + }, + { + id: 19, + title: "بوشهر", + slug: "Bushehr", + latitude: 28.9233837, + longitude: 50.820314, + }, + { + id: 24, + title: "تهران", + slug: "Tehran", + latitude: 35.696111, + longitude: 51.423056, + }, + { + id: 30, + title: "خراسان جنوبي", + slug: "South Khorasan", + latitude: 32.5175643, + longitude: 59.1041758, + }, + { + id: 10, + title: "خراسان رضوئ", + slug: "Khorasan Razavi", + latitude: 32.5175643, + longitude: 59.1041758, + }, + { + id: 29, + title: "خراسان شمالي", + slug: "North Khorasan", + latitude: 37.4710353, + longitude: 57.1013188, + }, + { + id: 7, + title: "خوزستان", + slug: "Khuzestan", + latitude: 31.4360149, + longitude: 49.041312, + }, + { + id: 20, + title: "زنجان", + slug: "Zanjan", + latitude: 36.5018185, + longitude: 48.3988186, + }, + { + id: 21, + title: "سمنان", + slug: "Semnan", + latitude: 35.2255585, + longitude: 54.4342138, + }, + { + id: 12, + title: "سيستان وبلوچستان", + slug: "Sistan and Baluchistan", + latitude: 27.5299906, + longitude: 60.5820676, + }, + { + id: 8, + title: "فارس", + slug: "Fars", + latitude: 29.1043813, + longitude: 53.045893, + }, + { + id: 27, + title: "قزوين", + slug: "Qazvin", + latitude: 36.0881317, + longitude: 49.8547266, + }, + { + id: 26, + title: "قم", + slug: "Qom", + latitude: 34.6399443, + longitude: 50.8759419, + }, + { + id: 13, + title: "كردستان", + slug: "Kurdistan", + latitude: 31.4360149, + longitude: 49.041312, + }, + { + id: 9, + title: "كرمان", + slug: "Kerman", + latitude: 30.2839379, + longitude: 57.0833628, + }, + { + id: 6, + title: "کرمانشاه", + slug: "Kermanshah", + latitude: 34.314167, + longitude: 47.065, + }, + { + id: 18, + title: "كهگيلويه وبويراحمد", + slug: "Kohgiloyeh Boyerahmad", + latitude: 30.6509479, + longitude: 51.60525, + }, + { + id: 28, + title: "گلستان", + slug: "Golestan", + latitude: 37.2898123, + longitude: 55.1375834, + }, + { + id: 2, + title: "گيلان", + slug: "Gilan", + latitude: 37.2809, + longitude: 49.5924, + }, + { + id: 16, + title: "لرستان", + slug: "Lorestan", + latitude: 31.4360149, + longitude: 49.041312, + }, + { + id: 3, + title: "مازندران", + slug: "Mazandaran", + latitude: 36.2262393, + longitude: 52.5318604, + }, + { + id: 1, + title: "مرکزی", + slug: "Markazi", + latitude: 34.6123, + longitude: 49.8547, + }, + { + id: 23, + title: "هرمزگان", + slug: "Hormozgan", + latitude: 30.2839379, + longitude: 57.0833628, + }, + { + id: 14, + title: "همدان", + slug: "Hamedan", + latitude: 27.138723, + longitude: 55.1375834, + }, + { + id: 15, + title: "چهارمحال وبختياری", + slug: "Chaharmahal and Bakhtiari ", + latitude: 31.9614348, + longitude: 50.8456323, + }, + { + id: 22, + title: "یزد", + slug: "Yazd", + latitude: 0, + longitude: 0, + }, + ]; +}; diff --git a/package-lock.json b/package-lock.json index f1db0ab..482e75c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vesmeh", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "vesmeh", - "version": "0.1.0", + "version": "0.1.1", "dependencies": { "@headlessui/react": "^1.7.17", "axios": "^1.6.5", @@ -18,8 +18,11 @@ "react-dom": "^18", "react-grid-gallery": "^1.0.1-alpha.0", "react-image-gallery": "^1.3.0", + "react-image-lightbox": "^5.1.4", + "react-infinite-scroll-component": "^6.1.0", "react-spring-bottom-sheet": "^3.4.1", "react-toastify": "^9.1.3", + "simple-react-validator": "^1.6.2", "swiper": "^11.0.5" }, "devDependencies": { @@ -1968,6 +1971,11 @@ "node": ">=0.10.0" } }, + "node_modules/exenv": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", + "integrity": "sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw==" + }, "node_modules/external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", @@ -4007,11 +4015,59 @@ "react": "^16.0.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-image-lightbox": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/react-image-lightbox/-/react-image-lightbox-5.1.4.tgz", + "integrity": "sha512-kTiAODz091bgT7SlWNHab0LSMZAPJtlNWDGKv7pLlLY1krmf7FuG1zxE0wyPpeA8gPdwfr3cu6sPwZRqWsc3Eg==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dependencies": { + "prop-types": "^15.7.2", + "react-modal": "^3.11.1" + }, + "peerDependencies": { + "react": "16.x || 17.x", + "react-dom": "16.x || 17.x" + } + }, + "node_modules/react-infinite-scroll-component": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/react-infinite-scroll-component/-/react-infinite-scroll-component-6.1.0.tgz", + "integrity": "sha512-SQu5nCqy8DxQWpnUVLx7V7b7LcA37aM7tvoWjTLZp1dk6EJibM5/4EJKzOnl07/BsM1Y40sKLuqjCwwH/xV0TQ==", + "dependencies": { + "throttle-debounce": "^2.1.0" + }, + "peerDependencies": { + "react": ">=16.0.0" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/react-lifecycles-compat": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" + }, + "node_modules/react-modal": { + "version": "3.16.1", + "resolved": "https://registry.npmjs.org/react-modal/-/react-modal-3.16.1.tgz", + "integrity": "sha512-VStHgI3BVcGo7OXczvnJN7yT2TWHJPDXZWyI/a0ssFNhGZWsPmB8cF0z33ewDXq4VfYMO1vXgiv/g8Nj9NDyWg==", + "dependencies": { + "exenv": "^1.2.0", + "prop-types": "^15.7.2", + "react-lifecycles-compat": "^3.0.0", + "warning": "^4.0.3" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "react": "^0.14.0 || ^15.0.0 || ^16 || ^17 || ^18", + "react-dom": "^0.14.0 || ^15.0.0 || ^16 || ^17 || ^18" + } + }, "node_modules/react-spring": { "version": "8.0.27", "resolved": "https://registry.npmjs.org/react-spring/-/react-spring-8.0.27.tgz", @@ -4092,30 +4148,6 @@ } } }, - "node_modules/react-spring-bottom-sheet/node_modules/react-dom": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", - "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" - }, - "peerDependencies": { - "react": "17.0.2" - } - }, - "node_modules/react-spring-bottom-sheet/node_modules/scheduler": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", - "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", - "peer": true, - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" - } - }, "node_modules/react-toastify": { "version": "9.1.3", "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-9.1.3.tgz", @@ -4472,6 +4504,11 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, + "node_modules/simple-react-validator": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/simple-react-validator/-/simple-react-validator-1.6.2.tgz", + "integrity": "sha512-49KhaVh7wXTANXKuvLtRebK1RKTBi3Cu/7jf8ssBdL+9ShZOfW74nkPWK+AFj4NApSYpYozMQ27ZybE630SNVA==" + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -4803,6 +4840,14 @@ "node": ">=0.8" } }, + "node_modules/throttle-debounce": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-2.3.0.tgz", + "integrity": "sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -4955,20 +5000,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "dev": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", diff --git a/package.json b/package.json index afd2809..30c3507 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,11 @@ "react-dom": "^18", "react-grid-gallery": "^1.0.1-alpha.0", "react-image-gallery": "^1.3.0", + "react-image-lightbox": "^5.1.4", + "react-infinite-scroll-component": "^6.1.0", "react-spring-bottom-sheet": "^3.4.1", "react-toastify": "^9.1.3", + "simple-react-validator": "^1.6.2", "swiper": "^11.0.5" }, "devDependencies": { diff --git a/plugins/Chapar/index.js b/plugins/Chapar/index.js index 8243fe0..cb7291e 100644 --- a/plugins/Chapar/index.js +++ b/plugins/Chapar/index.js @@ -1,7 +1,7 @@ import axios from "axios"; export const getToken = () => { - return "Bearer " + localStorage.token; + return localStorage.token; }; const Chapar = axios.create({ diff --git a/plugins/Gallery/page.jsx b/plugins/Gallery/page.jsx index 251cd12..869064e 100644 --- a/plugins/Gallery/page.jsx +++ b/plugins/Gallery/page.jsx @@ -1,86 +1,75 @@ "use client "; -import React from "react"; +import React, { useContext, useState } from "react"; import p1 from "../../public/images/product/1.png"; import p2 from "../../public/images/product/2.png"; import p3 from "../../public/images/product/3.png"; -import p4 from "../../public/images/product/4.png"; +import logo from "../../public/images/logo.png"; import Image from "next/image"; +import Lightbox from "react-image-lightbox"; +import AppContext from "@ctx/AppContext"; const GalleryBox = ({ file }) => { - console.log(file && file[0]?.fileLocation); + const CTX = useContext(AppContext); + + const isOpenLightBox = CTX.state.isOpenLightBox; + + console.log("image", file); return (
    -
    -
    - {!!file ? ( +
    +
    + {file?.length > 0 ? ( CTX.setIsOpenLightBox(true)} /> ) : (
    - {/* */} + />
    )}
    -
    -
    -
    - +
    + {file?.map((e) => ( +
    CTX.setIsOpenLightBox(true)} + > +
    + {e.fileName} +
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    + ))} +
    -
    -
    - -
    -
    - -
    -
    - {" "} - -
    -
    -
    -
    - {" "} - -
    -
    -
    -
    - {" "} - -
    -
    - -
    -
    - {" "} - -
    -
    +
    + {isOpenLightBox && ( + CTX.setIsOpenLightBox(false)} + onImageLoadError={(e) => console.log(e)} + imageLoadErrorMessage={"باز نمیشه ؟!!!"} + /> + )}
    ); diff --git a/plugins/bottomSheet/BottomSheetAddress.jsx b/plugins/bottomSheet/BottomSheetAddress.jsx new file mode 100644 index 0000000..60ed21e --- /dev/null +++ b/plugins/bottomSheet/BottomSheetAddress.jsx @@ -0,0 +1,390 @@ +"use client"; + +import AppContext from "@ctx/AppContext"; +import { iranCities } from "iranCities"; +import { iranProvince } from "iranProvince"; +import Chapar from "plugins/Chapar"; +import React, { useContext, useEffect, useRef, useState } from "react"; +import { BottomSheet } from "react-spring-bottom-sheet"; +import { toast } from "react-toastify"; +import SimpleReactValidator from "simple-react-validator"; + +const BottomSheetAddress = () => { + const CTX = useContext(AppContext); + const provinceData = iranProvince(); + const citiesData = iranCities(); + + const [province, setProvince] = useState(null); + const [city, setCity] = useState(null); + const [cityData, setCityData] = useState([]); + const [plaque, setPlaque] = useState(""); + const [address, setAddress] = useState(""); + const [buildingUnit, setBuildingUnit] = useState(""); + const [postalCode, setPostalCode] = useState(""); + const [receiverFullName, setReceiverFullName] = useState(""); + const [receiverPhoneNumber, setReceiverPhoneNumber] = useState(""); + + const validator = useRef( + new SimpleReactValidator({ + messages: { + required: "پر کردن این فیلد الزامی میباشد", + }, + element: (message) => ( + <> +
    + {message} +
    + + ), + }) + ); + + const body = { + address, + province: provinceData?.find((e) => e.id == province)?.title, + city: citiesData?.find((e) => e.id == city)?.title, + plaque, + buildingUnit, + receiverFullName, + receiverPhoneNumber, + postalCode, + }; + + const handleCreateAddress = async () => { + if (validator.current.allValid()) { + try { + const data = await Chapar.post( + `${process.env.NEXT_PUBLIC_API_URL}/user/address`, + JSON.stringify(body), + { + headers: { + Authorization: localStorage.getItem("token"), + }, + } + ); + + toast.success(`آدرس اضافه شد`, { + position: "bottom-right", + closeOnClick: true, + }); + + CTX.setBottomSheetAddressOpen(false); + CTX.fetchAddressUser(); + } catch ({ error, status }) { + toast.error(`${error?.response?.data?.message}`, { + position: "bottom-right", + closeOnClick: true, + }); + } + } else { + toast.error("پرکردن همه ی فیلد ها واجب است", { + position: "bottom-right", + autoClose: 2000, + hideProgressBar: false, + closeOnClick: true, + pauseOnHover: true, + draggable: true, + progress: undefined, + }); + } + }; + + useEffect(() => { + setCityData(citiesData.filter((city) => city.province_id == province)); + }, [province]); + + return ( + CTX.setBottomSheetAddressOpen(false)} + className={"z-50 relative "} + > +
    +
    +

    اقزودن آدرس جدید

    +
    + +
    + + + + +
    + + {" "} + {validator ? ( + <> + {validator.current.message("province", province, "required")} + + ) : ( + "" + )} + +
    +
    + +
    + + + +
    + + {" "} + {validator ? ( + <>{validator.current.message("city", city, "required")} + ) : ( + "" + )} + +
    +
    + +
    + + + { + setAddress(e.target.value); + validator.current.showMessageFor("address"); + }} + /> +
    + + {" "} + {validator ? ( + <>{validator.current.message("address", address, "required")} + ) : ( + "" + )} + +
    +
    + +
    + + + { + setPlaque(e.target.value); + validator.current.showMessageFor("plaque"); + }} + /> + +
    + + {" "} + {validator ? ( + <>{validator.current.message("plaque", plaque, "required")} + ) : ( + "" + )} + +
    +
    + +
    + + + { + setBuildingUnit(e.target.value); + validator.current.showMessageFor("buildingUnit"); + }} + /> + +
    + + {" "} + {validator ? ( + <> + {validator.current.message( + "buildingUnit", + buildingUnit, + "required" + )} + + ) : ( + "" + )} + +
    +
    + +
    + + + { + setPostalCode(e.target.value); + validator.current.showMessageFor("postalCode"); + }} + /> + +
    + + {" "} + {validator ? ( + <> + {validator.current.message( + "postalCode", + postalCode, + "required" + )} + + ) : ( + "" + )} + +
    +
    + +
    + + + { + setReceiverFullName(e.target.value); + validator.current.showMessageFor("receiverFullName"); + }} + /> + +
    + + {" "} + {validator ? ( + <> + {validator.current.message( + "receiverFullName", + receiverFullName, + "required" + )} + + ) : ( + "" + )} + +
    +
    + +
    + + + { + setReceiverPhoneNumber(e.target.value); + validator.current.showMessageFor("receiverPhoneNumber"); + }} + className="form-control bg-white !border-[1px] focus:!border-[1px] border-gray-400 focus:!border-gray-300 rounded-lg text-right !text-sm tr03 " + placeholder="0912......" + /> + +
    + + {" "} + {validator ? ( + <> + {validator.current.message( + "receiverPhoneNumber", + receiverPhoneNumber, + "required" + )} + + ) : ( + "" + )} + +
    +
    + +
    + +
    +
    +
    + ); +}; + +export default BottomSheetAddress; diff --git a/plugins/bottomSheet/BottomSheetDeleteAddress.jsx b/plugins/bottomSheet/BottomSheetDeleteAddress.jsx new file mode 100644 index 0000000..3398383 --- /dev/null +++ b/plugins/bottomSheet/BottomSheetDeleteAddress.jsx @@ -0,0 +1,50 @@ +"use client"; + +import CardCart from "@comp/Cards/CardCart/page"; +import AppContext from "@ctx/AppContext"; +import Link from "next/link"; +import PersianNumber from "plugins/PersianNumber"; +import React, { useContext } from "react"; +import { BottomSheet } from "react-spring-bottom-sheet"; +import { toast } from "react-toastify"; + +const BottomSheetDeleteAddress = ({ id }) => { + const CTX = useContext(AppContext); + const cart = CTX.state.cart; + + const handleDelete = async (id) => { + try { + const data = await Chapar.post( + `${process.env.NEXT_PUBLIC_API_URL}/user/address/${id}` + ); + } catch ({ error, status }) { + toast.error(`${error?.response?.data?.message}`, { + position: "bottom-right", + closeOnClick: true, + }); + } + }; + + return ( + CTX.setBottomSheetDeleteAddressOpen(false)} + className={"z-50 relative"} + > +
    +

    آیا از حذف آدرس اطمینان دارید ؟

    +
    + +
    + +
    +
    + ); +}; + +export default BottomSheetDeleteAddress; diff --git a/plugins/bottomSheet/BottomSheetDiscount.jsx b/plugins/bottomSheet/BottomSheetDiscount.jsx index f5eb7da..e9552e8 100644 --- a/plugins/bottomSheet/BottomSheetDiscount.jsx +++ b/plugins/bottomSheet/BottomSheetDiscount.jsx @@ -3,15 +3,39 @@ import CardCart from "@comp/Cards/CardCart/page"; import AppContext from "@ctx/AppContext"; import Link from "next/link"; +import Chapar from "plugins/Chapar"; import PersianNumber from "plugins/PersianNumber"; -import React, { useContext } from "react"; +import React, { useContext, useState } from "react"; import { BottomSheet } from "react-spring-bottom-sheet"; import { toast } from "react-toastify"; -const BottomSheetDiscount = (props) => { +const BottomSheetDiscount = ({ orderId }) => { const CTX = useContext(AppContext); - const cart = CTX.state.cart; + const [discountCode, setDiscountCode] = useState(null); + + const body = { orderId, discountCode }; + + const handleDiscount = async () => { + try { + const data = await Chapar.post( + `${process.env.NEXT_PUBLIC_API_URL}/order/bag/discount/${orderId}?discountCode=${discountCode}`, + + { + headers: { + Authorization: localStorage.getItem("token"), + }, + } + ); + CTX.setCheckOutData(data); + CTX.setBottomSheetDiscountOpen(false); + } catch ({ error, status }) { + toast.error(`${error?.response?.data?.message}`, { + position: "bottom-right", + closeOnClick: true, + }); + } + }; return ( { type="text" className="form-control bg-white !border-[1px] focus:!border-[1px] border-gray-400 focus:!border-gray-300 rounded-lg text-right !text-sm tr03 " placeholder="کد را وارد کنید" + onChange={(e) => setDiscountCode(e.target.value)} />
    -
    diff --git a/plugins/bottomSheet/BottomSheetLogOut.jsx b/plugins/bottomSheet/BottomSheetLogOut.jsx new file mode 100644 index 0000000..12d8232 --- /dev/null +++ b/plugins/bottomSheet/BottomSheetLogOut.jsx @@ -0,0 +1,46 @@ +"use client"; + +import CardCart from "@comp/Cards/CardCart/page"; +import AppContext from "@ctx/AppContext"; +import Link from "next/link"; +import { useRouter } from "next/navigation"; +import PersianNumber from "plugins/PersianNumber"; +import React, { useContext } from "react"; +import { BottomSheet } from "react-spring-bottom-sheet"; +import { toast } from "react-toastify"; + +const BottomSheetLogOut = ({ id }) => { + const CTX = useContext(AppContext); + const cart = CTX.state.cart; + const router = useRouter(); + + const handleLogOut = async () => { + localStorage.removeItem("token"); + router.push("/"); + }; + + return ( + CTX.setBottomSheetLogOutOpen(false)} + className={"z-50 relative"} + > +
    +

    + آیا از خروج حساب کاربری اطمینان دارید ؟{" "} +

    +
    + +
    + +
    +
    + ); +}; + +export default BottomSheetLogOut; diff --git a/src/app/cart/checkout/page.jsx b/src/app/cart/checkout/page.jsx index b4fb4ab..a59c523 100644 --- a/src/app/cart/checkout/page.jsx +++ b/src/app/cart/checkout/page.jsx @@ -2,7 +2,7 @@ import NavBarDownCart from "@comp/Carts/component/NavBarDownCart/page"; import Navbar from "@comp/Navbar/page"; import PersianNumber from "plugins/PersianNumber"; -import React, { useContext, useEffect } from "react"; +import React, { useContext, useEffect, useState } from "react"; import zarin from "@img/zarin.png"; import ap from "@img/ap.png"; @@ -10,18 +10,119 @@ import Image from "next/image"; import AppContext from "@ctx/AppContext"; import BottomSheetDiscount from "plugins/bottomSheet/BottomSheetDiscount"; import { useRouter } from "next/navigation"; +import BottomSheetAddress from "plugins/bottomSheet/BottomSheetAddress"; +import Chapar from "plugins/Chapar"; +import { toast } from "react-toastify"; const page = () => { const CTX = useContext(AppContext); + const [shippingData, setShippingData] = useState([]); + const [shippingId, setShippingID] = useState(null); + const [addressData, setAddressData] = useState([]); + const [addressId, setAddressId] = useState(null); + const [permissionGoPay, setPermissionGoPay] = useState(false); + const router = useRouter(); const checkOutData = CTX.state.checkOutData; - console.log(checkOutData); + const body = { + addressId: addressData[addressId]?.id, + + orderId: checkOutData?.id, + shippingId: shippingData[shippingId]?.id, + }; + + console.log(body); + + const GetShippingData = async () => { + try { + const data = await Chapar.get( + `${process.env.NEXT_PUBLIC_API_URL}/warehouse/shipping?page=0` + ); + + setShippingData(data); + } catch ({ error, status }) { + toast.error(`${error?.response?.data?.message}`, { + position: "bottom-right", + closeOnClick: true, + }); + } + }; + + const handleShippingID = async (index) => { + if (addressId !== null) { + setShippingID(index); + try { + const data = await Chapar.post( + `${process.env.NEXT_PUBLIC_API_URL}/order/bag/shipping/${checkOutData?.id}`, + JSON.stringify({ + addressId: addressData[addressId]?.id, + + orderId: checkOutData?.id, + shippingId: shippingData[index]?.id, + }), + { + headers: { + Authorization: localStorage.getItem("token"), + }, + } + ); + CTX.setCheckOutData(data); + setPermissionGoPay(true); + console.log(data); + } catch ({ error, status }) { + toast.error(`${error?.response?.data?.message}`, { + position: "bottom-right", + closeOnClick: true, + }); + } + } else { + toast.error(`ابتدا آدرس را انتحاب کنید`, { + position: "bottom-right", + closeOnClick: true, + }); + } + }; + + const handleGoPayment = async () => { + try { + const data = await Chapar.post( + `${process.env.NEXT_PUBLIC_API_URL}/order/bag/payment/${checkOutData?.id}?paymentMethod=1`, + + { + headers: { + Authorization: localStorage.getItem("token"), + }, + } + ); + } catch ({ error, status }) { + toast.error(`${error?.response?.data?.message}`, { + position: "bottom-right", + closeOnClick: true, + }); + } + }; + + useEffect(() => { + if (shippingData.length <= 0) { + GetShippingData(); + } + + if (CTX.state.addressData <= 0) { + CTX.fetchAddressUser(); + } + }, [checkOutData]); + + useEffect(() => { + setAddressData(CTX.state.addressData); + }, [CTX.state.addressData]); useEffect(() => { if (CTX.state.checkOutData.length <= 0) { router.push("/cart"); } + + setPermissionGoPay(false); }, []); return ( @@ -29,268 +130,49 @@ const page = () => {
    -
    -

    آدس ها

    +
    +
    +

    آدس ها

    -
    -

    تغییر آدرس

    -
    -
    - -
    -
    - CTX.setBottomSheetAddressOpen(true)} > - - - +

    + افزودن آدرس جدید +

    +
    -
    -

    - آدرس شما{" "} -

    -

    - {" "} - تهران ، نارمک ، فلکه پنجم پلاک 5 ، واحد 22 -

    -
    -
    -
    -

    زمان و نحوه ارسال

    - -
    -
    + {addressData.map((e, index) => ( +
    setAddressId(index)} + >
    - -
    -

    - سریع ترین زمان ارسال -

    -
    -
    -
    - -
    -
    -
    - - - -
    -
    -

    - ارسال با پیک (فقط محدوده تهران){" "} -

    -

    - {" "} - - ساعت - | - هزینه ارسال - - هزار تومان -

    -
    -
    - -
    -
    - - - -
    -
    -

    - پست عادی{" "} -

    -

    - {" "} - حداکثر - - روز کاری - | - هزینه ارسال - - هزار تومان -

    -
    -
    - -
    -
    - - - - -
    -
    -

    - پست سفارشی{" "} -

    -

    - {" "} - هزینه ارسال - - هزار تومان -

    -
    -
    - -
    -
    - - - - -
    -
    -

    - پست پیشتاز{" "} -

    -

    - {" "} - حداکثر - - روز کاری - | هزینه ارسال - - هزار تومان -

    -
    -
    -
    - -
    -

    روش پرداخت

    -
    - -
    -
    -
    - -
    -
    -

    - پرداخت آنلاین -

    -

    زرین پال

    -
    -
    - -
    -
    - -
    -
    -

    - پرداخت آنلاین -

    -

    آسان پرداخت

    -
    -
    -
    CTX.setBottomSheetDiscountOpen(true)} - > -
    -
    - - + {
    -

    - افزودن کد تخفیف{" "} -

    -

    - کد تخفیف خود را وارد کنید -

    +

    {e.address}

    + ))} -
    - + -
    -
    -
    +
    +

    زمان و نحوه ارسال

    -
    -
    -

    حساب نهایی

    - -
    -

    مشاهده اقلام

    +
    +
    +
    + + + +
    +

    + سریع ترین زمان ارسال +

    +
    -
    -

    قیمت

    + {shippingData?.map((e, index) => ( +
    handleShippingID(index)} + > +
    + + + + +
    +
    +

    + {e.name}{" "} +

    +

    + {" "} + حداکثر + + روز کاری + | هزینه ارسال + + هزار تومان +

    +
    +
    + ))} +
    -
    -

    - -

    - - {" "} - تومان - +
    +

    روش پرداخت

    +
    + +
    +
    +
    + +
    +
    +

    + پرداخت آنلاین +

    +

    زرین پال

    -
    -

    تخفیف محصول

    - -
    -

    - -

    - - {" "} - تومان - +
    +
    + +
    +
    +

    + پرداخت آنلاین (به زودی) +

    +

    آسان پرداخت

    +
    { + if (checkOutData?.discountCode == "") { + CTX.setBottomSheetDiscountOpen(true); + } + }} + > +
    +
    + + + +
    +
    +

    + افزودن کد تخفیف{" "} +

    +

    + کد تخفیف خود را وارد کنید +

    +
    +
    -
    -

    هزینه بسته بندی

    - -
    -

    - -

    - - {" "} - تومان - +
    + +
    - -
    -

    هزینه ارسال

    - -
    -

    - -

    - - {" "} - تومان - -
    -
    - -
    -

    - قابل پرداخت +

    +

    + کد تخفیف ثبت شد{" "}

    +
    +
    -
    -

    - +

    +
    +

    حساب نهایی

    + +
    +

    مشاهده اقلام

    +
    +
    + +
    +
    +

    قیمت

    + +
    +

    + +

    + + {" "} + تومان + +
    +
    + +
    +

    تخفیف محصول

    + +
    +

    + +

    + + {" "} + تومان + +
    +
    + +
    +

    + هزینه بسته بندی

    - - {" "} - تومان - + +
    +

    + +

    + + {" "} + تومان + +
    +
    + +
    +

    هزینه ارسال

    + +
    +

    + +

    + + {" "} + تومان + +
    +
    + +
    +

    + قابل پرداخت +

    + +
    +

    + +

    + + {" "} + تومان + +
    - console.log("D")} + calculateTotalCost={checkOutData.totalPrice / 10} + event={() => handleGoPayment()} + permissionGoPay={permissionGoPay} />
    - + ); }; diff --git a/src/app/cart/page.jsx b/src/app/cart/page.jsx index 7f84811..498c3d3 100644 --- a/src/app/cart/page.jsx +++ b/src/app/cart/page.jsx @@ -85,94 +85,99 @@ const page = () => {
    -
    -

    محصولات انتخاب شده

    - -
    -

    - - محصول +

    +
    +

    + محصولات انتخاب شده

    -
    -
    -
    - {cart?.map((e) => ( - - ))} +
    +

    + + محصول +

    +
    +
    -
    -

    حساب نهایی

    + {cart?.map((e) => ( + + ))} - {/*
    +
    +
    +

    حساب نهایی

    + + {/*

    محصول

    */} -
    - -
    -
    -

    قیمت

    - -
    -

    - -

    - - {" "} - تومان - -
    -
    -

    تخفیف محصول

    +
    +
    +

    قیمت

    -
    -

    - -

    - - {" "} - تومان - +
    +

    + +

    + + {" "} + تومان + +
    -
    -
    -

    - قابل پرداخت -

    +
    +

    تخفیف محصول

    -
    -

    - +

    +

    + +

    + + {" "} + تومان + +
    +
    + +
    +

    + قابل پرداخت

    - - {" "} - تومان - + +
    +

    + +

    + + {" "} + تومان + +
    @@ -182,6 +187,7 @@ const page = () => { handleGoCheckOut()} + permissionGoPay={true} />
    diff --git a/src/app/categories/[id]/page.jsx b/src/app/categories/[id]/page.jsx index beeaca7..3449a5f 100644 --- a/src/app/categories/[id]/page.jsx +++ b/src/app/categories/[id]/page.jsx @@ -9,11 +9,16 @@ import FilterCategory from "@comp/Category/FilterCategory/page"; import ListProductsMobile from "@comp/Category/Mobile/ListProductsMobile/page"; import PaginationCategoory from "@comp/Category/PaginationCategoory/page"; import AppContext from "@ctx/AppContext"; +import InfiniteScroll from "react-infinite-scroll-component"; export default function page({ params }) { // const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/product?page=0`); // const products = await res.json(); const CTX = useContext(AppContext); + const pageGetProducts = CTX.state.pageGetProducts; + const stopGetTasks = CTX.state.stopGetTasks; + const pager = CTX.state.pager; + const [isChecked, setIsChecked] = useState(false); const [selectedBrands, setSelectedBrands] = useState([]); const [rangePrice, setRangePrice] = useState([1000, 100]); @@ -26,19 +31,83 @@ export default function page({ params }) { CTX.setBrands(brands); }; + const handleInfiniteNextFetchProducts = () => { + CTX.setPageGetProducts((e) => e + 1); + CTX.fetchProducts( + pageGetProducts + 1, + params.id, + selectedBrands, + isChecked, + rangePrice, + rangePrice, + sortBy, + isRangePrice + ); + }; + useEffect(() => { - CTX.fetchProducts(params.id); + window.scrollTo({ + top: 0, + behavior: "smooth", // Optional: smooth scrolling behavior + }); + CTX.fetchProducts(0, params.id); fetchBarnds(); }, []); + console.log(pager?.totalPage > 1, pager?.totalPage); + return ( <>
    + {!CTX.state.isMobile && ( +
    +
    + -
    -
    - + {true ? ( + + + + ) : ( +
    +
    + چیزی یافت نشد +
    +
    + )} +
    +
    +
    + )} + + {CTX.state.isMobile && ( +
    + - -
    -
    -
    - - -
    +
    + {true ? ( + + + + ) : ( +
    +
    + چیزی یافت نشد +
    +
    + )} +
    +
    + )}
    - + {pager?.totalPage > 1 && ( + + )}
    diff --git a/src/app/faq/page.jsx b/src/app/faq/page.jsx new file mode 100644 index 0000000..1360b79 --- /dev/null +++ b/src/app/faq/page.jsx @@ -0,0 +1,81 @@ +"use client"; + +import Footer from "@comp/Footer/page"; +import Navbar from "@comp/Navbar/page"; +import PersianNumber from "plugins/PersianNumber"; +import React, { useEffect, useState } from "react"; + +const page = () => { + const [faq, setFaq] = useState([]); + const [faqSelect, setFaqSelect] = useState(0); + + const fetchNavData = async (id) => { + const res = await fetch(`https://jsonplaceholder.typicode.com/comments`); + const post = await res.json(); + setFaq(post); + }; + + useEffect(() => { + fetchNavData(); + }, []); + return ( + <> +
    +
    + + +
    +
    +
    +

    + {" "} + , +

    +
    +
    +
    + +
    +
    +

    + پرسش‌های متداول +

    +
    +
    +
    +
    + +
    + {faq?.map((e, index) => ( +
    setFaqSelect(index)} + > +
    + + {faqSelect == index ? "-" : "+"} + +

    + {e.name} +

    +
    + {faqSelect == index && ( + <> +
    +

    + {e.body} +

    + + )} +
    + ))} +
    + +
    + + ); +}; + +export default page; diff --git a/src/app/layout.jsx b/src/app/layout.jsx index fa46a1c..45f8d10 100644 --- a/src/app/layout.jsx +++ b/src/app/layout.jsx @@ -10,10 +10,15 @@ import "react-toastify/dist/ReactToastify.css"; import { ToastContainer, toast } from "react-toastify"; import Loading from "plugins/Loading/page"; import "react-spring-bottom-sheet/dist/style.css"; +import BottomSheetAddress from "plugins/bottomSheet/BottomSheetAddress"; +import citiesJSON from "iranCities"; +import BottomSheetLogOut from "plugins/bottomSheet/BottomSheetLogOut"; +import "react-image-lightbox/style.css"; export default function RootLayout({ children }) { const [cart, setCart] = useState([]); const [products, setProducts] = useState([]); + const [pager, setPager] = useState([]); const [navData, setNavData] = useState([]); const [brands, setBrands] = useState([]); const [loading, setLoading] = useState(false); @@ -21,9 +26,19 @@ export default function RootLayout({ children }) { const [bottomSheetCartOpen, setBottomSheetCartOpen] = useState(false); const [bottomSheetFilterOpen, setBottomSheetFilterOpen] = useState(false); const [bottomSheetDiscountOpen, setBottomSheetDiscountOpen] = useState(false); + const [bottomSheetAddressOpen, setBottomSheetAddressOpen] = useState(false); + const [bottomSheetLogOutOpen, setBottomSheetLogOutOpen] = useState(false); + const [bottomSheetDeleteAddressOpen, setBottomSheetDeleteAddressOpen] = + useState(false); const [checkOutData, setCheckOutData] = useState([]); + const [addressData, setAddressData] = useState([]); + const [profile, setProfile] = useState([]); + const [stopProducts, setStopProducts] = useState(false); + const [pageGetProducts, setPageGetProducts] = useState(0); + const [isMobile, setIsMobile] = useState(false); + const [isOpenLightBox, setIsOpenLightBox] = useState(false); - console.log(navData); + console.log("products", products); const AddItemToCart = ( id, @@ -128,17 +143,21 @@ export default function RootLayout({ children }) { }; const fetchProducts = async ( + pageGetProducts, id, selectedBrands, isChecked, minPrice, maxPrice, sort, - isRangePrice + isRangePrice, + paginationSay ) => { const brandIds = selectedBrands?.map((brand) => brand.id); - const queryString = `page=0${id ? `&categoryId=${id}` : ""}${ + const queryString = `${`page=${pageGetProducts}`}${ + id ? `&categoryId=${id}` : "" + }${ brandIds?.length > 0 ? `&brandIds=${brandIds?.join("&brandIds=")}` : "" }${isChecked ? `&isActive=${isChecked}` : ""}${ isRangePrice ? `&minPrice=${minPrice}` : "" @@ -153,18 +172,113 @@ export default function RootLayout({ children }) { `${process.env.NEXT_PUBLIC_API_URL}/product?${cleanQueryString}` ); const post = await res.json(); - setProducts(post); + if (paginationSay) { + // If it's a paginated request (not the first page) + window.scrollTo({ + top: 0, + behavior: "smooth", // Optional: smooth scrolling behavior + }); + console.log(); + setProducts(post.products); + setStopProducts(true); // Assuming this stops pagination + } + + if (post.length <= 19) { + // If the length of fetched products is less than or equal to 19, indicating the last page + setStopProducts(true); // Assuming this stops pagination + } + + if (!paginationSay && pageGetProducts == 0) { + // If it's not a paginated request and it's the first page + setProducts(post.products); + setPager(post.pager); + } else if (!paginationSay && pageGetProducts != 0) { + // If it's not a paginated request and it's not the first page + console.log("kir", products, !!products ? products : [], post.products); + setProducts((data) => [...(data ? data : []), ...post.products]); + } + }; + + const fetchAddressUser = async () => { + try { + const data = await Chapar.get( + `${process.env.NEXT_PUBLIC_API_URL}/user/address`, + { + headers: { + Authorization: localStorage.getItem("token"), + }, + } + ); + + setAddressData(data); + } catch ({ error, status }) { + toast.error(`${error?.response?.data?.message}`, { + position: "bottom-right", + closeOnClick: true, + }); + setLoading(false); + } + }; + + const fetchUserInfo = async () => { + try { + const data = await Chapar.get( + `${process.env.NEXT_PUBLIC_API_URL}/user/info`, + { + headers: { + Authorization: localStorage.getItem("token"), + }, + } + ); + + setProfile(data); + } catch ({ error, status }) { + localStorage.removeItem("token"); + toast.error(`${error?.response?.data?.message}`, { + position: "bottom-right", + closeOnClick: true, + }); + } }; useEffect(() => { const storedCart = localStorage.getItem("cart"); + const token = localStorage.getItem("token"); if (storedCart) { setCart(JSON.parse(storedCart)); } + if (token) { + fetchUserInfo(); + } + fetchNavData(); }, []); + useEffect(() => { + const mediaQuery = window.matchMedia("(max-width: 768px)"); // Adjust the width according to your mobile breakpoint + + const checkDeviceType = (mediaQuery) => { + if (mediaQuery.matches) { + setIsMobile(true); + } else { + setIsMobile(false); + } + }; + + // Initial check + checkDeviceType(mediaQuery); + + // Listen for changes in media query + const listener = () => checkDeviceType(mediaQuery); + mediaQuery.addEventListener("change", listener); + + // Clean up + return () => { + mediaQuery.removeEventListener("change", listener); + }; + }, []); + return ( @@ -201,6 +336,8 @@ export default function RootLayout({ children }) { {children} + + diff --git a/src/app/login/page.jsx b/src/app/login/page.jsx index f4449a0..6f357aa 100644 --- a/src/app/login/page.jsx +++ b/src/app/login/page.jsx @@ -58,6 +58,7 @@ const Login = () => { if (data.user.signUpStatus == 1) { setStepLogin(2); + CTX.setProfile(data); } else if (data.user.signUpStatus == 10) { // setProfile(data); toast.success(` ${data.user.firstName} جان خوش اومدی `, { @@ -92,7 +93,7 @@ const Login = () => { ); CTX.setLoading(false); - + CTX.setProfile(data); if (data.user.signUpStatus == 10) { // setProfile(data); diff --git a/src/app/page.jsx b/src/app/page.jsx index 3e5df35..a529bf9 100644 --- a/src/app/page.jsx +++ b/src/app/page.jsx @@ -48,11 +48,11 @@ export default function Page() {
    - + - - + +