import React, { Component } from "react"; import { userProduct, comment, file } from "~/Redux/actions"; import Navbar from "../Home/Navbar/index"; import Input from "../Contact/Input/index"; import Select from "../Contact/Select/index"; import Upload from "./Upload"; import "./index.scss"; import { connect } from "react-redux"; const maxDesktopSize = 1250; const maxMobileSize = 550; const fontSize = { desktop: { h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40, p: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 80, span: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 80, }, mobile: { h1: window.innerWidth > maxMobileSize ? 25 : window.innerWidth / 16, p: window.innerWidth > maxMobileSize ? 14 : window.innerWidth / 34, span: window.innerWidth > maxMobileSize ? 15 : window.innerWidth / 32, }, }; class Support extends Component { state = { name: null, cellphone: null, unit: null, bookId: null, subject: null, text: null, file: null, fileId: null, }; componentDidMount() { if (!this.props.myProductList && this.props.status) this.props.getUserProductList({}); } onChange = (name, value, type) => { if (type === "file") { this.props.upload({ file: value, target: name }); } this.setState({ [name]: value, }); }; async send() { const { submit, status: { userId }, } = this.props; const { text, fileId, name, cellphone, unit, bookId, subject } = this.state; await submit({ fileId, text, name, cellphone, unit, bookId, subject, userId, }); //todo redirectHome } render() { const grades = [ window.t("پیش دبستان"), window.t("اول"), window.t("دوم"), window.t("سوم"), window.t("چهارم"), window.t("پنجم"), window.t("ششم"), window.t("هفتم"), window.t("هشتم"), window.t("نهم"), window.t("دهم"), window.t("یازدهم"), window.t("دوازدهم"), ]; let { status } = this.props; let opt = [ window.t("واحد مورد نظر"), window.t("واحد فروش"), window.t("واحد فنی"), window.t("واحد محتوایی"), ]; opt = opt.map((e) => [e, e]); return ( <>
{window.t( "برای ارتباط با دنیای شگفت انگیز دانوین از فرم زیر استفاده کنید و پس از انتخاب دپارتمان مد نظر پیام خود را ارسال کنید." )}{" "}
{status ? null : ( <> > )} {this.state.unit === window.t("واحد محتوایی") ? (