From 6e81fdc01696cd5d9c64c3c005232f1ba0e21249 Mon Sep 17 00:00:00 2001 From: Pkpedram Date: Sat, 19 Feb 2022 11:06:18 +0330 Subject: [PATCH] Call Back Finished --- src/App.js | 3 ++ src/components/CallBackForm/index.js | 74 ++++++++++++++++++++++++++++ src/utils/filter.js | 61 +++++++++++++++++++++++ src/view/CallBack/index.js | 13 +++++ tailwind.config.js | 3 ++ 5 files changed, 154 insertions(+) create mode 100644 src/components/CallBackForm/index.js create mode 100644 src/utils/filter.js create mode 100644 src/view/CallBack/index.js diff --git a/src/App.js b/src/App.js index 4ce493e..01596e0 100644 --- a/src/App.js +++ b/src/App.js @@ -27,6 +27,7 @@ import store from './redux/store'; import ContactUs from './view/contact'; import ENTER_EXAM from './view/Exam/EnterExam/index' import EXAM from './view/Exam' +import CallBack from './view/CallBack'; let data = [ @@ -689,6 +690,8 @@ function App() { showUserFullInfo={showUserFullInfo} hideUserFullInfo={hideUserFullInfo} />} /> */} + + } /> } /> }/> } /> diff --git a/src/components/CallBackForm/index.js b/src/components/CallBackForm/index.js new file mode 100644 index 0000000..93b8b5e --- /dev/null +++ b/src/components/CallBackForm/index.js @@ -0,0 +1,74 @@ +import React from "react"; +import { Link } from "react-router-dom"; + +const CallBackForm = ({ + status, + price, + trackingCode +}) => { + return ( +
+ + { + status ? +
+
+ + + +
+ +

پرداخت شما با موفقیت انجام شد

+
: +
+
+ + + + + + + + + +
+ +

متاسفانه پرداخت شما انجام نشد

+
+ } +
+ مبلغ : {price} تومان +
+
+ کد پیگیری : {trackingCode} +
+ + + { + status ? +
+ + لیست خدمات من + +
+ : +
+ + بازگست به سبد خرید + + + پرداخت مجدد + +
+ } +
+ ) +} + +export default CallBackForm; \ No newline at end of file diff --git a/src/utils/filter.js b/src/utils/filter.js new file mode 100644 index 0000000..e2faaa5 --- /dev/null +++ b/src/utils/filter.js @@ -0,0 +1,61 @@ +const grades = [ + "پیش دبستان", + "اول", + "دوم", + "سوم", + "چهارم", + "پنجم", + "ششم", + "هفتم", + "هشتم", + "نهم", + "دهم", + "یازدهم", + "دوازدهم", +]; +class filter { + productsPage = (products, options) => { + const { grade, subject, sort } = options; + + if (grade.length > 0 || subject.length > 0 || sort) { + localStorage.setItem("filter", "ON"); + } + let finalSort; + let byGradeFilter = []; + if (grade.length > 0) { + grade.map((item1) => { + for (let i = 0; i < products.length; i++) { + if (grades[products[i].gradeId] === item1) { + byGradeFilter.push(products[i]); + } + } + }); + } else { + byGradeFilter = products; + } + let bySubjectFilter = []; + if (subject.length > 0) { + subject.map((item1) => { + for (let i = 0; i < byGradeFilter.length; i++) { + if (byGradeFilter[i].name === item1) { + bySubjectFilter.push(byGradeFilter[i]); + } + } + }); + } else { + bySubjectFilter = byGradeFilter; + } + + if (sort === "گران ترین") { + finalSort = bySubjectFilter.sort((item1, item2) => { + return item1.product[0].price - item2.product[0].price; + }); + } else { + finalSort = bySubjectFilter; + } + }; +} + +const _filter = new filter(); + +export default _filter; diff --git a/src/view/CallBack/index.js b/src/view/CallBack/index.js new file mode 100644 index 0000000..30709ee --- /dev/null +++ b/src/view/CallBack/index.js @@ -0,0 +1,13 @@ +import React from 'react'; +import CallBackForm from '../../components/CallBackForm'; + +const CallBack = () => { + return( +
+ +
+ ); + +}; + +export default CallBack; \ No newline at end of file diff --git a/tailwind.config.js b/tailwind.config.js index 57770a9..441925c 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -30,8 +30,11 @@ module.exports = { grayEC: '#ececec', red82OP: 'rgba(223, 20, 82, 0.08)', pinkF5: '#fff1f5', + pinkD6 : '#ffd6d6', black40: '#404040', green17 : '#8daf17', + greenE9 : '#dcffe9', + green13: '#00ba13', blue5F : '#05335f', blue7E : '#15517e', blueFF : '#f2f9ff',