recette2
parent
2ad11d67c4
commit
0aabb0b99f
|
@ -129,7 +129,7 @@ function App() {
|
|||
<Route path="/Survey/:survey_id/" exact component={SurveyDocument} />
|
||||
<Route path="/UpadateAttendeeList/:client_id/:session_id/:partner_owner_recid/" exact component={UpdateAttendeeList} />
|
||||
|
||||
<Route path="/Automatic-Quotation/:partner_owner_recid/:objid" exact component={AutomaticQuotation} />
|
||||
<Route path="/automatic-auotation/:partner_owner_recid/:objid/" exact component={AutomaticQuotation} />
|
||||
|
||||
<Route component={NotFound} />
|
||||
</Switch>
|
||||
|
|
|
@ -1,33 +1,102 @@
|
|||
import React, { useState, useEffect } from "react";
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import Navigation from "../components/Navigation";
|
||||
import bannerimg2 from "./../mysy_img/MYSY-LOGO-BLUE.png";
|
||||
import ok_png from "./../mysy_img/Ok_PNG.png";
|
||||
import { Helmet } from "react-helmet";
|
||||
import Footer from "./../components/Fotter";
|
||||
import Header from "./../components/Header";
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { useParams } from 'react-router-dom';
|
||||
import img_loading_spin from "./../mysy_img/mysy_spin_loading.gif";
|
||||
import axios from "axios";
|
||||
|
||||
const Automaticquotation = () => {
|
||||
|
||||
const { objid, partner_owner_recid } = useParams();
|
||||
|
||||
const [tempo, settempo] = useState(".");
|
||||
setInterval(check, 2300);
|
||||
//setInterval(check, 2300);
|
||||
|
||||
/*
|
||||
window.setTimeout(function () {
|
||||
window.location.href = process.env.REACT_APP_BASE_URL
|
||||
}, 7000);
|
||||
|
||||
*/
|
||||
|
||||
function check() {
|
||||
var val = tempo + " .";
|
||||
//alert(" val = "+val);
|
||||
settempo(val);
|
||||
//settempo(val);
|
||||
|
||||
}
|
||||
|
||||
const [isLoading, setLoading] = useState();
|
||||
|
||||
|
||||
const [Create_Automatic_Quotation_api, setCreate_Automatic_Quotation_api] = useState();
|
||||
const [Create_Automatic_Quotation_message, setCreate_Automatic_Quotation_message] = useState();
|
||||
const [Create_Automatic_Quotation_result, setCreate_Automatic_Quotation_result] = useState();
|
||||
function Create_Automatic_Quotation() {
|
||||
var form = new FormData();
|
||||
//form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
|
||||
|
||||
|
||||
form.append("partner_owner_recid", partner_owner_recid);
|
||||
form.append("lead_website_id", objid);
|
||||
|
||||
var myurl = process.env.REACT_APP_API_URL + "myclass/api/Create_Automatic_Quotation/";
|
||||
|
||||
// setLoading(true);
|
||||
|
||||
|
||||
|
||||
axios.post(myurl, form).then(res => {
|
||||
console.log(" In Create_Automatic_Quotation res.data.status = " + res.data.status);
|
||||
console.log(" In Create_Automatic_Quotation res.data.message r_class = " + res.data.message);
|
||||
|
||||
// setLoading(false);
|
||||
if (String(res.data.status) === String("true")) {
|
||||
setCreate_Automatic_Quotation_api("true");
|
||||
setCreate_Automatic_Quotation_result(res.data.message);
|
||||
|
||||
//myRef_head.current.scrollIntoView({ behavior: "smooth" });
|
||||
|
||||
}
|
||||
else {
|
||||
setCreate_Automatic_Quotation_api("false");
|
||||
setCreate_Automatic_Quotation_message(res.data.message);
|
||||
alert(res.data.message);
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
|
||||
//setLoading(false);
|
||||
console.warn('UpdateStagiaireData : Not good man :( Create_Automatic_Quotation = ' + error);
|
||||
setCreate_Automatic_Quotation_api("false");
|
||||
alert(" Impossible de créer le devis");
|
||||
|
||||
})
|
||||
}
|
||||
const initialized = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (!initialized.current) {
|
||||
initialized.current = true
|
||||
console.log(" aaaaaa")
|
||||
Create_Automatic_Quotation();
|
||||
}
|
||||
|
||||
}, [Create_Automatic_Quotation_api]);
|
||||
|
||||
|
||||
return (
|
||||
<div className="notfound">
|
||||
|
||||
{isLoading && <div className="loader-container">
|
||||
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
|
||||
</div>}
|
||||
|
||||
|
||||
<div>
|
||||
<Navigation />
|
||||
</div>
|
||||
|
@ -43,12 +112,27 @@ const Automaticquotation = () => {
|
|||
|
||||
|
||||
<div className="div_mobile">
|
||||
<div className="nom_prenom"> Votre devis est en cours de création <img src={ok_png} className="img_ok"/> </div>
|
||||
{isLoading && <div className="loader-container">
|
||||
<div className="mysy_spinner"> <img src={img_loading_spin} /> </div>
|
||||
</div>}
|
||||
{/*<div className="nom_prenom"> Votre devis est en cours de création <img src={ok_png} className="img_ok" /> </div>*/}
|
||||
<div className="nom_prenom">
|
||||
<div>
|
||||
Vous allez être redirigé vers le moteur de recherche dans quelques secondes. {tempo}
|
||||
Votre devis est en cours de création . {tempo}
|
||||
Create_Automatic_Quotation_api = {Create_Automatic_Quotation_api}
|
||||
|
||||
objid = {objid}
|
||||
{Create_Automatic_Quotation_api && String(Create_Automatic_Quotation_api) === "false" &&
|
||||
<div style={{ "color": "red" }}>
|
||||
Impossible de créer le devis : {Create_Automatic_Quotation_message}
|
||||
</div>
|
||||
}
|
||||
|
||||
{Create_Automatic_Quotation_api && String(Create_Automatic_Quotation_api) === "true" &&
|
||||
<div style={{ "color": "green" }}>
|
||||
|
||||
{Create_Automatic_Quotation_message}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,38 @@
|
|||
.notfound {
|
||||
|
||||
.loader-container {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
background: white;
|
||||
background-color: transparent;
|
||||
z-index: 1;
|
||||
top: 0px;
|
||||
opacity: 80%;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
width: 20rem;
|
||||
height: 10rem;
|
||||
border: 8px solid;
|
||||
border-color: #3d5af1 transparent #3d5af1 transparent;
|
||||
border-radius: 50%;
|
||||
animation: spin-anim 1.2s linear infinite;
|
||||
background-color: red;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.mysy_spinner {
|
||||
border-radius: 5px;
|
||||
//border: 1px solid black;
|
||||
opacity: 100%;
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
.nom_prenom {
|
||||
font-family: "verdana", "Quicksand", "Signika", sans-serif;
|
||||
|
|
Loading…
Reference in New Issue