Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b39a7ab58c | |||
| ad90def3c9 | |||
| 737430bf04 | |||
| d371ada805 | |||
| b77f1d6213 |
@@ -112,15 +112,9 @@ const GeneralTab = memo(({
|
|||||||
<>
|
<>
|
||||||
{isCustom === true ?
|
{isCustom === true ?
|
||||||
<>
|
<>
|
||||||
{(tabKey === 'template_tab') && <SiteTemplateSelector name={name} data={sortedData}
|
{(tabKey === 'template_tab') && <SiteTemplateSelector name={name} data={sortedData} isCustom={isCustom} productData={productData}/>}
|
||||||
isCustom={isCustom}
|
{(tabKey === 'url_config_tab') && <URLConfiguration name={name} data={sortedData} isCustom={isCustom} productData={productData}/>}
|
||||||
productData={productData}/>}
|
{(tabKey === 'color_scheme_tab') && <ColorStyleConfigure name={name} data={sortedData} isCustom={isCustom} productData={productData}/>}
|
||||||
{(tabKey === 'url_config_tab') && <URLConfiguration name={name} data={sortedData}
|
|
||||||
isCustom={isCustom}
|
|
||||||
productData={productData}/>}
|
|
||||||
{(tabKey === 'color_scheme_tab') && <ColorStyleConfigure name={name} data={sortedData}
|
|
||||||
isCustom={isCustom}
|
|
||||||
productData={productData}/>}
|
|
||||||
</>
|
</>
|
||||||
:
|
:
|
||||||
<div className="page-account-form">
|
<div className="page-account-form">
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import React, {memo} from 'react'
|
import React, {memo} from 'react'
|
||||||
import getImage from "../../../utils/getImage";
|
import getImage from "../../../utils/getImage";
|
||||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query';
|
||||||
import queryKeys from '../../../services/queryKeys';
|
import queryKeys from '../../../services/queryKeys';
|
||||||
import { getProductTemplateData, activateTemplate } from '../../../services/services';
|
import {getProductTemplateData, activateTemplate} from '../../../services/services';
|
||||||
|
|
||||||
const SiteTemplateSelector = memo(({name='Full Name', data, productData}) =>{
|
const SiteTemplateSelector = memo(({name = 'Full Name', data, productData}) => {
|
||||||
|
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
const {data:templateData, isFetching, isError, error} = useQuery({
|
const {data: templateData, isFetching, isError, error} = useQuery({
|
||||||
queryKey: queryKeys.productTemplateData,
|
queryKey: queryKeys.productTemplateData,
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
let reqData = {
|
let reqData = {
|
||||||
@@ -16,7 +16,7 @@ const SiteTemplateSelector = memo(({name='Full Name', data, productData}) =>{
|
|||||||
uid: localStorage.getItem('uid'), // USER UID
|
uid: localStorage.getItem('uid'), // USER UID
|
||||||
product_id: productData?.product_id
|
product_id: productData?.product_id
|
||||||
}
|
}
|
||||||
return getProductTemplateData(reqData)
|
return getProductTemplateData(reqData)
|
||||||
},
|
},
|
||||||
staleTime: 0
|
staleTime: 0
|
||||||
})
|
})
|
||||||
@@ -24,16 +24,17 @@ const SiteTemplateSelector = memo(({name='Full Name', data, productData}) =>{
|
|||||||
const templateResponse = templateData?.data
|
const templateResponse = templateData?.data
|
||||||
const currentTemUID = templateResponse?.current_template_uid
|
const currentTemUID = templateResponse?.current_template_uid
|
||||||
const templates = templateResponse?.templates
|
const templates = templateResponse?.templates
|
||||||
|
const custom_template_name = templateResponse?.custom_template_name
|
||||||
|
|
||||||
// console.log('data Template', templateResponse)
|
// console.log('data Template', templateResponse)
|
||||||
// console.log("Page data == ", data)
|
console.log("Page data == ", data)
|
||||||
|
|
||||||
const handleActivateTemplate = useMutation({
|
const handleActivateTemplate = useMutation({
|
||||||
mutationFn: (fields) => {
|
mutationFn: (fields) => {
|
||||||
return activateTemplate(fields)
|
return activateTemplate(fields)
|
||||||
},
|
},
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
if(res?.data?.resultCode != '0'){
|
if (res?.data?.resultCode != '0') {
|
||||||
throw new Error(res.data.resultDescription)
|
throw new Error(res.data.resultDescription)
|
||||||
}
|
}
|
||||||
queryClient.refetchQueries({ // refetches productProvision API call
|
queryClient.refetchQueries({ // refetches productProvision API call
|
||||||
@@ -41,7 +42,7 @@ const SiteTemplateSelector = memo(({name='Full Name', data, productData}) =>{
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
onSettled: () => {
|
onSettled: () => {
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
handleActivateTemplate.reset()
|
handleActivateTemplate.reset()
|
||||||
}, 3000)
|
}, 3000)
|
||||||
}
|
}
|
||||||
@@ -57,51 +58,57 @@ const SiteTemplateSelector = memo(({name='Full Name', data, productData}) =>{
|
|||||||
// console.log(reqData)
|
// console.log(reqData)
|
||||||
handleActivateTemplate.mutate(reqData)
|
handleActivateTemplate.mutate(reqData)
|
||||||
}
|
}
|
||||||
|
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 (
|
return (
|
||||||
<div className="page-account-form">
|
<div className="page-account-form">
|
||||||
<div className="p-0">
|
<div className="p-0">
|
||||||
{isFetching ?
|
{isFetching ?
|
||||||
<>
|
|
||||||
<div className="row">
|
|
||||||
<div className="col-12">
|
|
||||||
<p className='text-mute'>Loading...</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
: isError ?
|
|
||||||
<div className="row">
|
|
||||||
<div className="col-12">
|
|
||||||
<p className='text-danger'>{error?.message}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
:
|
|
||||||
<div className="row">
|
|
||||||
<>
|
<>
|
||||||
{!templates?.length ?
|
<div className="row">
|
||||||
<p>No data Found</p>
|
<div className="col-12">
|
||||||
:
|
<p className='text-mute'>Loading...</p>
|
||||||
templates.map(template => (
|
|
||||||
<div key={template.template_uid} className="col-xl-6 col-sm-6">
|
|
||||||
<div className="card card-statistics">
|
|
||||||
<div className="card-body">
|
|
||||||
<div className="text-center p-2">
|
|
||||||
<div className="mb-2">
|
|
||||||
<img src={getImage('file-icon/svg.png')} alt={template.title} />
|
|
||||||
</div>
|
|
||||||
<h4 className="mb-0">{template.title}</h4>
|
|
||||||
{currentTemUID == template.template_uid ?
|
|
||||||
<button className="btn btn-light" disabled={true}>Active</button>
|
|
||||||
:
|
|
||||||
<button onClick={()=>handleSubmit(template.template_uid)} className="btn btn-primary">Activate</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
))
|
</div>
|
||||||
}
|
</>
|
||||||
{/* {Object.entries(data)?.map(([key, value]) => (
|
: isError ?
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-danger'>{error?.message}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
|
<div className="row">
|
||||||
|
<>
|
||||||
|
{!templates?.length ?
|
||||||
|
<p>No data Found</p>
|
||||||
|
:
|
||||||
|
templates.map(template => (
|
||||||
|
<div key={template.template_uid} className="col-xl-6 col-sm-6">
|
||||||
|
<div className="card card-statistics">
|
||||||
|
<div className="card-body">
|
||||||
|
<div className="text-center p-2">
|
||||||
|
<div className="mb-2">
|
||||||
|
<img src={getImage('file-icon/svg.png')}
|
||||||
|
alt={template.title}/>
|
||||||
|
</div>
|
||||||
|
<h4 className="mb-0">{template.title}</h4>
|
||||||
|
{currentTemUID == template.template_uid ?
|
||||||
|
<button className="btn btn-light"
|
||||||
|
disabled={true}>Active</button>
|
||||||
|
:
|
||||||
|
<button onClick={() => handleSubmit(template.template_uid)}
|
||||||
|
className="btn btn-primary">Activate</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
{/* {Object.entries(data)?.map(([key, value]) => (
|
||||||
<div key={key} className="col-xl-6 col-sm-6">
|
<div key={key} className="col-xl-6 col-sm-6">
|
||||||
<div className="card card-statistics">
|
<div className="card card-statistics">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
@@ -116,24 +123,25 @@ const SiteTemplateSelector = memo(({name='Full Name', data, productData}) =>{
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))} */}
|
))} */}
|
||||||
</>
|
</>
|
||||||
|
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
<>
|
<>
|
||||||
{handleActivateTemplate.isPending ?
|
{handleActivateTemplate.isPending ?
|
||||||
<p className={'text-center '}>loading...</p>
|
<p className={'text-center '}>loading...</p>
|
||||||
:
|
:
|
||||||
handleActivateTemplate.isError ?
|
handleActivateTemplate.isError ?
|
||||||
<p className={'text-center text-danger'}>{handleActivateTemplate.error.message}</p>
|
<p className={'text-center text-danger'}>{handleActivateTemplate.error.message}</p>
|
||||||
:
|
:
|
||||||
handleActivateTemplate.isSuccess?
|
handleActivateTemplate.isSuccess ?
|
||||||
<p className={'text-center text-success'}>Templated activated successfully</p>
|
<p className={'text-center text-success'}>Templated activated
|
||||||
:
|
successfully</p>
|
||||||
null
|
:
|
||||||
}
|
null
|
||||||
</>
|
}
|
||||||
</div>
|
</>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,40 +1,84 @@
|
|||||||
const URLConfiguration = () => {
|
import { Form, Formik } from "formik";
|
||||||
|
import * as Yup from "yup";
|
||||||
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
import { completePWDReset } from '../../../services/services';
|
||||||
|
|
||||||
|
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'),
|
||||||
|
})
|
||||||
|
|
||||||
|
const initialValues = {
|
||||||
|
url: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
const URLConfiguration = ({productData}) => {
|
||||||
|
|
||||||
|
let defaultUrl= 'https://'+productData?.internal_url
|
||||||
|
|
||||||
|
// API to set url
|
||||||
|
const setURL = useMutation({
|
||||||
|
mutationFn: (fields) => {
|
||||||
|
return completePWDReset(fields)
|
||||||
|
},
|
||||||
|
// onSuccess: (res) => {
|
||||||
|
// },
|
||||||
|
// onError: (err) => {
|
||||||
|
// console.log('err', err)
|
||||||
|
// }
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleSubmit = (values) => {
|
||||||
|
let reqData = {
|
||||||
|
url: values.url
|
||||||
|
}
|
||||||
|
console.log('URL', values.url)
|
||||||
|
// setURL.mutate(reqData)
|
||||||
|
}
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<div className="card card-statistics">
|
<div className="card card-statistics">
|
||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="card-heading">
|
<div className="card-heading">
|
||||||
<h4 className="card-title">URL Configuration</h4>
|
<h4 className="card-title">Default URL</h4>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="card-body button-list">
|
|
||||||
<div className="row">
|
|
||||||
<div className="col-12 mb-2">
|
|
||||||
<div className="alert alert-primary" role="alert" style={{borderRadius: '10px'}}>
|
|
||||||
<h3 className="text-white">Default URL</h3>
|
|
||||||
<p className="text-white">
|
|
||||||
https://127476.devprov.mermsemr.com
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="card card-statistics">
|
|
||||||
<div className="card-header">
|
|
||||||
<div className="card-heading">
|
|
||||||
<h4 className="card-title">Default</h4>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label htmlFor="exampleInputEmail1">Email address</label>
|
{/*<label htmlFor="exampleInputEmail1">Email address</label>*/}
|
||||||
<input type="email" className="form-control" id="exampleInputEmail1"
|
<input type="email" className="form-control"
|
||||||
aria-describedby="emailHelp" placeholder="Enter your url"/>
|
aria-describedby="defaultUrlHelp" value={defaultUrl} readOnly={true} />
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" className="btn btn-primary">Submit</button>
|
{/*<button type="submit" className="btn btn-primary">Submit</button>*/}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Formik
|
||||||
|
initialValues={initialValues}
|
||||||
|
validationSchema={validationSchema}
|
||||||
|
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>
|
||||||
|
</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>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Formik>
|
||||||
|
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export default function ProfileCompleteCom() {
|
|||||||
mutationFn: (fields) => {
|
mutationFn: (fields) => {
|
||||||
const {practice, specialization, url_name} = fields
|
const {practice, specialization, url_name} = fields
|
||||||
if (!practice || !specialization || !url_name) {
|
if (!practice || !specialization || !url_name) {
|
||||||
throw new Error('Please select both practice, specialization and Enter URL_Name')
|
throw new Error('Please Select both Practice, Specialization and Enter URL_Name')
|
||||||
}
|
}
|
||||||
return completeProfile(fields)
|
return completeProfile(fields)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user