Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2dc12d7d0a | |||
| 164195d4cc | |||
| 7ad1a585ea | |||
| a8c2dd84f1 | |||
| ddcc6f0cd2 | |||
| 683f81e8a6 | |||
| 8e09c30c5c | |||
| af0d4db5de | |||
| 6f3dae4116 | |||
| 13900793af | |||
| 698c89edfc | |||
| 4f5a383c99 | |||
| a5b6a11880 | |||
| 0f58da3dce | |||
| 1101e80d91 |
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
@@ -41,7 +41,7 @@ export default function SocketIOContextProvider({children}) {
|
||||
socket.on(socketOnEvents.receive_message, (data) => {
|
||||
// setSocketMsgReceived(data.message);
|
||||
// dispatch(tableReload({type:'CHATMESSAGELIST'})) // dispatches to update chat message sending from owner to worker and vice versa
|
||||
console.log('DATA', data)
|
||||
console.log('SOCKET RECEIVED DATA *** ', data)
|
||||
queryClient.refetchQueries({
|
||||
queryKey: [...queryKeys.recentAction],
|
||||
// type: 'active',
|
||||
|
||||
@@ -59,7 +59,7 @@ export default function DashPayments() {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{payments.length > 0 ?
|
||||
{payments && payments?.length > 0 ?
|
||||
payments.map((item, index) => {
|
||||
return (
|
||||
<tr key={index}>
|
||||
|
||||
@@ -78,6 +78,7 @@ export default function UserHeader(){
|
||||
<span className="bg-success user-status"></span>
|
||||
</a>
|
||||
<div ref={nav_menu} onClick={toggleMenu} className="dropdown-menu animated fadeIn">
|
||||
<div className="position-fixed" style={{top: '0px', left: '0px', right: '0px', bottom: '0px'}}></div>
|
||||
<div className="bg-gradient px-4 py-3">
|
||||
<div className="d-flex align-items-center justify-content-between">
|
||||
<div className="mr-1">
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
import React, { useMemo, useRef, useState } from "react";
|
||||
import React, {useEffect, useMemo, useRef, useState} from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import getImage from "../../utils/getImage";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { productRefreshSite, getSettingsData } from "../../services/services";
|
||||
import Settings from "./settingsTab/Settings";
|
||||
import queryKeys from "../../services/queryKeys";
|
||||
import {SocketContextValues} from "../context/SocketIOContext";
|
||||
|
||||
|
||||
export default function ProductActive({productData}){
|
||||
|
||||
const {joinRoom} = SocketContextValues() // Destructures values from socket context
|
||||
const iframe = useRef()
|
||||
|
||||
const [refreshMsg, setRefreshMsg] = useState('')
|
||||
|
||||
const refresh = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return productRefreshSite(fields)
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
setRefreshMsg(res?.data?.message)
|
||||
setTimeout(()=>{setRefreshMsg('')},3000)
|
||||
iframe.current.src += ''
|
||||
}
|
||||
})
|
||||
@@ -31,6 +36,13 @@ export default function ProductActive({productData}){
|
||||
}
|
||||
let externalUrl= 'https://'+productData?.internal_url
|
||||
|
||||
const productSubUID = productData.subscription_uid;
|
||||
useEffect(() => {
|
||||
const provision_room = "PROVISION_"+productSubUID;
|
||||
console.log("JOINING ROOM ON ACTIVE *** ", provision_room);
|
||||
joinRoom(provision_room); // provision subscription room
|
||||
}, [])
|
||||
|
||||
return(
|
||||
<>
|
||||
{/*<BreadcrumbComBS title='Active Product Name' paths={['Dashboard', 'Product']} />*/}
|
||||
@@ -58,8 +70,13 @@ export default function ProductActive({productData}){
|
||||
<iframe ref={iframe} style={{borderWidth: '0px'}} src={externalUrl} width="100%" height="600" title={externalUrl}></iframe>
|
||||
</div>
|
||||
<div className="p-4 ml-auto">
|
||||
<button type="button" onClick={handleRefresh} className="btn btn-primary">{refresh.isPending ? 'Loading...' : 'Refresh Site'}
|
||||
</button>
|
||||
<div className="d-flex justify-end gap-3">
|
||||
{refreshMsg &&
|
||||
<p className="text-success text-center">{refreshMsg}</p>
|
||||
}
|
||||
<button type="button" onClick={handleRefresh} className="btn btn-primary">{refresh.isPending ? 'Initiating...' : 'Rebuild Site'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,39 +1,41 @@
|
||||
import { useEffect } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {useEffect} from "react";
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
import queryKeys from "../../services/queryKeys";
|
||||
import { productProvision } from "../../services/services";
|
||||
import {productProvision} from "../../services/services";
|
||||
import getImage from "../../utils/getImage";
|
||||
import { SocketContextValues } from "../context/SocketIOContext";
|
||||
import {SocketContextValues} from "../context/SocketIOContext";
|
||||
|
||||
|
||||
export default function ProductProvision(props){
|
||||
export default function ProductProvision(props) {
|
||||
const {joinRoom} = SocketContextValues() // Destructures values from socket context
|
||||
|
||||
const productTitle = props?.productData?.title;
|
||||
const productDescription = props?.productData?.description;
|
||||
const productTitle = props?.productData?.title;
|
||||
const productDescription = props?.productData?.description;
|
||||
const productID = props?.productData?.product_id
|
||||
const productUID = props?.productData?.product_uid
|
||||
const productSubUID = props?.productData?.product_subscription_uid
|
||||
|
||||
const reqData = {
|
||||
product_id : productID,
|
||||
product_id: productID,
|
||||
product_subscription_uid: productSubUID
|
||||
}
|
||||
|
||||
const {data:provision, isFetching, isError, error} = useQuery({
|
||||
const {data: provision, isFetching, isError, error} = useQuery({
|
||||
queryKey: queryKeys.myproduct_provision,
|
||||
queryFn: () => productProvision(reqData)
|
||||
})
|
||||
|
||||
const provisionData = provision?.data
|
||||
|
||||
useEffect(()=>{
|
||||
joinRoom(productSubUID); // provision subscription room
|
||||
},[])
|
||||
useEffect(() => {
|
||||
const provision_room = "PROVISION_"+productSubUID;
|
||||
console.log("JOINING ROOM ON START *** ", provision_room);
|
||||
joinRoom(provision_room); // provision subscription room
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
{isFetching ?
|
||||
{isFetching ?
|
||||
<>
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
@@ -42,82 +44,87 @@ export default function ProductProvision(props){
|
||||
</div>
|
||||
</>
|
||||
: isError ?
|
||||
<div className="row">
|
||||
<div className="col-12">
|
||||
<p className='text-danger'>{error.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
<>
|
||||
<div className="row">
|
||||
<div className="col-md-12">
|
||||
<div className="card card-statistics">
|
||||
<div className="card-header">
|
||||
<div className="col-12">
|
||||
<p className='text-danger'>{error.message}</p>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
<>
|
||||
<div className="row">
|
||||
<div className="col-md-12">
|
||||
<div className="card card-statistics">
|
||||
<div className="card-header">
|
||||
<div className="card-heading">
|
||||
<h4 className="card-title">Creating - {productTitle} </h4>
|
||||
<h4 className="card-title">Creating - {productTitle} </h4>
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="progress">
|
||||
<div className="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"
|
||||
aria-valuenow={`${provisionData?.percent_completed}%`} aria-valuemin="0" aria-valuemax="100" style={{width:`${provisionData?.percent_completed}%`}} ></div>
|
||||
<div className="progress-bar progress-bar-striped progress-bar-animated"
|
||||
role="progressbar"
|
||||
aria-valuenow={`${provisionData?.percent_completed}%`}
|
||||
aria-valuemin="0" aria-valuemax="100"
|
||||
style={{width: `${provisionData?.percent_completed}%`}}></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-md-12">
|
||||
<div className="row">
|
||||
<div className="col-md-12">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-lg-6">
|
||||
<div className="row">
|
||||
<div className="col-lg-6">
|
||||
|
||||
<div className="card card-statistics">
|
||||
<div className="card-header">
|
||||
<div className="card-heading">
|
||||
<h4 className="card-title">Progress Information</h4>
|
||||
<div className="card card-statistics">
|
||||
<div className="card-header">
|
||||
<div className="card-heading">
|
||||
<h4 className="card-title">Progress Information</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="table-responsive">
|
||||
<table className="table table-info mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style={{width: '10px'}}>#</th>
|
||||
<th scope="col">Action</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{provisionData?.activities?.map(item => (
|
||||
<tr key={item.id}>
|
||||
<th scope="row">{item.id}</th>
|
||||
<td>{item.action}</td>
|
||||
<div className="card-body">
|
||||
<div className="table-responsive">
|
||||
<table className="table table-info mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" style={{width: '10px'}}>#</th>
|
||||
<th scope="col">Action</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{provisionData?.activities?.map(item => (
|
||||
<tr key={item.id}>
|
||||
<th scope="row">{item.id}</th>
|
||||
<td>{item.action}</td>
|
||||
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="col-lg-6">
|
||||
<div className="card card-statistics ">
|
||||
<h4 className="card-title" style={{padding:'10px'}}>Started creating your selection</h4>
|
||||
<img className="card-img-top" src={getImage('widget/working.jpg')} alt="Card image cap" />
|
||||
{/* <div className="card-body">
|
||||
<div className="col-lg-6">
|
||||
<div className="card card-statistics ">
|
||||
<h4 className="card-title" style={{padding: '10px'}}>Started creating your
|
||||
selection</h4>
|
||||
<img className="card-img-top" src={getImage('widget/working.jpg')}
|
||||
alt="Card image cap"/>
|
||||
{/* <div className="card-body">
|
||||
<div className="" dangerouslySetInnerHTML={{__html: productDescription}}/>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</>
|
||||
}
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -3,6 +3,8 @@ import getImage from "../../../utils/getImage";
|
||||
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query';
|
||||
import queryKeys from '../../../services/queryKeys';
|
||||
import {getProductTemplateData, activateTemplate} from '../../../services/services';
|
||||
import {Link} from "react-router-dom";
|
||||
import siteLinks from "../../../links/siteLinks";
|
||||
|
||||
const SiteTemplateSelector = memo(({name = 'Full Name', data, productData}) => {
|
||||
|
||||
@@ -60,7 +62,23 @@ const SiteTemplateSelector = memo(({name = 'Full Name', data, productData}) => {
|
||||
}
|
||||
if (custom_template_name && custom_template_name != '') {
|
||||
// This implies we have a custom template , just return here
|
||||
return <>This product is using a custom template named {custom_template_name} </>
|
||||
return <>
|
||||
<div className='col-12'>
|
||||
<div
|
||||
className="rounded-2 d-flex flex-column justify-content-between align-items-center"
|
||||
style={{backgroundColor: '#F2FAF7'}}>
|
||||
<h4 className='p-4 text-black'
|
||||
style={{marginBottom: '20px'}}>Custom Product Template.</h4>
|
||||
<img className='' style={{width: '200px'}}
|
||||
src={getImage('custom-template.png')}
|
||||
alt='mail-alert'/>
|
||||
<h4 className='p-4 text-black'
|
||||
style={{marginTop: '20px'}}>This product is using a custom template named <span
|
||||
style={{color: 'darkred'}}>“{custom_template_name}”</span> .</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</>
|
||||
}
|
||||
return (
|
||||
<div className="page-account-form">
|
||||
|
||||
@@ -1,27 +1,52 @@
|
||||
import { Form, Formik } from "formik";
|
||||
import {Form, Formik} from "formik";
|
||||
import * as Yup from "yup";
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { completePWDReset } from '../../../services/services';
|
||||
import {useMutation} from '@tanstack/react-query';
|
||||
import {setExternalURL} from '../../../services/services';
|
||||
import { useState } from "react";
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
url: Yup.string().required("URL is required").matches(/^https?:\/\/[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-]+\.[a-zA-Z]+/, 'Must be like: https://example.mysite.com'),
|
||||
})
|
||||
url: Yup.string().required("URL is required").matches(/^https?:\/\/[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-]+\.[a-zA-Z]+/, 'Must be like: https://example.mysite.com'),
|
||||
})
|
||||
|
||||
const initialValues = {
|
||||
url: '',
|
||||
};
|
||||
// const initialValues = {
|
||||
// url: '',
|
||||
// };
|
||||
|
||||
const URLConfiguration = ({productData}) => {
|
||||
|
||||
let defaultUrl= 'https://'+productData?.internal_url
|
||||
const [externalURLChanged, setExternalURLChanged] = useState(true)
|
||||
|
||||
const initialValues = {
|
||||
url: productData?.external_url || '',
|
||||
};
|
||||
|
||||
let defaultUrl = 'https://' + productData?.internal_url
|
||||
let externalUrl = productData?.external_url
|
||||
|
||||
const handleExternalURLChanged = (e) => {
|
||||
if(e.target.value == externalUrl){
|
||||
setExternalURLChanged(true)
|
||||
}else{
|
||||
setExternalURLChanged(false)
|
||||
}
|
||||
}
|
||||
|
||||
// API to set url
|
||||
const setURL = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
return completePWDReset(fields)
|
||||
return setExternalURL(fields)
|
||||
},
|
||||
// onSuccess: (res) => {
|
||||
// },
|
||||
onSuccess: (res) => {
|
||||
if (res.data.resultCode != '0') {
|
||||
// throw({message: res?.data?.resultDescription})
|
||||
throw({message: 'Something went wrong!'})
|
||||
}
|
||||
},
|
||||
onSettled: () => {
|
||||
setTimeout(() => {
|
||||
setURL.reset()
|
||||
}, 3000)
|
||||
}
|
||||
// onError: (err) => {
|
||||
// console.log('err', err)
|
||||
// }
|
||||
@@ -29,27 +54,28 @@ const URLConfiguration = ({productData}) => {
|
||||
|
||||
const handleSubmit = (values) => {
|
||||
let reqData = {
|
||||
url: values.url
|
||||
token: localStorage.getItem('token'), // USER TOKEN
|
||||
uid: localStorage.getItem('uid'), // USER UID
|
||||
subscription_uid: productData?.subscription_uid,
|
||||
external_url: values.url
|
||||
}
|
||||
console.log('URL', values.url)
|
||||
// setURL.mutate(reqData)
|
||||
setURL.mutate(reqData)
|
||||
}
|
||||
|
||||
return <>
|
||||
<div className="card card-statistics">
|
||||
<div className="card-header">
|
||||
<div className="card-heading">
|
||||
<h4 className="card-title">Default URL</h4>
|
||||
<h4 className="card-title" style={{textTransform: 'none'}}>{defaultUrl}</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="form-group">
|
||||
{/*<label htmlFor="exampleInputEmail1">Email address</label>*/}
|
||||
<input type="email" className="form-control"
|
||||
aria-describedby="defaultUrlHelp" value={defaultUrl} readOnly={true} />
|
||||
</div>
|
||||
{/*<button type="submit" className="btn btn-primary">Submit</button>*/}
|
||||
</div>
|
||||
{/*<div className="card-body">*/}
|
||||
{/* <div className="form-group">*/}
|
||||
{/* /!*<label htmlFor="exampleInputEmail1">Email address</label>*!/*/}
|
||||
{/* <input type="email" className="form-control"*/}
|
||||
{/* aria-describedby="defaultUrlHelp" value={defaultUrl} readOnly={true} />*/}
|
||||
{/* </div>*/}
|
||||
{/*</div>*/}
|
||||
</div>
|
||||
|
||||
<Formik
|
||||
@@ -58,24 +84,54 @@ const URLConfiguration = ({productData}) => {
|
||||
onSubmit={handleSubmit}
|
||||
>
|
||||
{(props) => {
|
||||
return (
|
||||
<Form className='w-full'>
|
||||
<div className="card card-statistics" style={{backgroundColor:'#7affd92b'}}>
|
||||
<div className="card-header">
|
||||
<div className="card-heading">
|
||||
<h4 className="card-title" style={{textTransform: 'none'}}>Set your own URL</h4>
|
||||
return (
|
||||
<Form className='w-full'>
|
||||
<div className="card card-statistics" style={{backgroundColor: '#b6e5ef'}}>
|
||||
<div className="card-header">
|
||||
<div className="card-heading">
|
||||
<h4 className="card-title" style={{textTransform: 'none'}}>Set your own URL</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="form-group">
|
||||
<label htmlFor="exampleInputEmail1">Enter your full URL <span
|
||||
className={`${(props.errors.url && props.touched.url) && 'text-danger'}`}>{props.errors.url}</span></label>
|
||||
<input value={props.values.url} onChange={(e)=>{props.handleChange(e); handleExternalURLChanged(e)}} type="text"
|
||||
className="form-control" id="url" aria-describedby="url"
|
||||
placeholder="https://example.mysite.com"/>
|
||||
</div>
|
||||
<div style={{width: '100%', textAlign: 'right'}}>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={setURL.isPending || externalURLChanged}
|
||||
className="btn btn-primary"
|
||||
>
|
||||
{setURL.isPending ? 'Loading...' : 'Submit'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{setURL.error &&
|
||||
<div className="col-12">
|
||||
<p className='text-danger'>{setURL.error.message}</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
{setURL.isSuccess &&
|
||||
<div className="col-12">
|
||||
<p className='text-success'>{'Completed successfully'}</p>
|
||||
</div>
|
||||
}
|
||||
<div style={{backgroundColor: '#94b8c0', borderRadius: '10px', padding: '10px'}}>
|
||||
Final steps to configure your URL:<br/>
|
||||
DNS:<br/>
|
||||
DNS:<br/>
|
||||
DNS:<br/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div className="card-body">
|
||||
<div className="form-group">
|
||||
<label htmlFor="exampleInputEmail1">Enter your full URL <span className={`${(props.errors.url && props.touched.url) && 'text-danger'}`}>{props.errors.url}</span></label>
|
||||
<input value={props.values.url} onChange={props.handleChange} type="text" className="form-control" id="url" aria-describedby="url" placeholder="https://example.mysite.com"/>
|
||||
</div>
|
||||
<button type="submit" className="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
</Form>
|
||||
);
|
||||
}}
|
||||
</Formik>
|
||||
|
||||
|
||||
@@ -246,6 +246,14 @@ export const getCommonPractice = (reqData) => {
|
||||
return postAuxEnd(`/panel/common/practice`, postData, false)
|
||||
}
|
||||
|
||||
// FUNCTION TO SET EXTERNAL URL
|
||||
export const setExternalURL = (reqData) => {
|
||||
let postData = {
|
||||
...reqData
|
||||
}
|
||||
return postAuxEnd('/panel/myproduct/external-url', postData, false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user