Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ea1047356 | |||
| 9b9a7cc5da | |||
| 290e1fbd7e | |||
| 6884aa19b2 | |||
| 597a45dcba | |||
| 4f7274c30c | |||
| 290356780c | |||
| bd1450887b | |||
| 923a2483ed | |||
| 7f0ccf35b2 | |||
| af2fdcede6 | |||
| a9f2136125 |
@@ -52,3 +52,10 @@ button{
|
|||||||
.accordion-button, .accordion-button:not(.collapsed) {
|
.accordion-button, .accordion-button:not(.collapsed) {
|
||||||
background-color: transparent!important;
|
background-color: transparent!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
.modal-50 {
|
||||||
|
min-width: 50%;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -117,7 +117,7 @@ console.log('imageLink', imageLink)
|
|||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-xl-6 col-xxl-4 m-b-30">
|
<div className="col-xl-6 col-xxl-4 m-b-30">
|
||||||
<div className="card card-statistics h-50 mb-0 widget-support-list">
|
<div className="card card-statistics mb-0 widget-support-list">
|
||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="card-heading">
|
<div className="card-heading">
|
||||||
<h4 className="card-title">Upload File</h4>
|
<h4 className="card-title">Upload File</h4>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default function ProductActive({productData}){
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="card-body" style={{minHeight: '680px'}}>
|
<div className="card-body" style={{minHeight: '600px', maxHeight: '600px'}}>
|
||||||
<iframe ref={iframe} style={{borderWidth: '0px'}} src={externalUrl} width="100%" height="600" title={externalUrl}></iframe>
|
<iframe ref={iframe} style={{borderWidth: '0px'}} src={externalUrl} width="100%" height="600" title={externalUrl}></iframe>
|
||||||
</div>
|
</div>
|
||||||
<div className="p-4 ml-auto">
|
<div className="p-4 ml-auto">
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import queryKeys from '../../../services/queryKeys';
|
|||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import sortObjectByListOrder from '../../../helpers/sortObjectByListOrder'
|
import sortObjectByListOrder from '../../../helpers/sortObjectByListOrder'
|
||||||
|
import TemplateConfigure from './TemplateConfigure';
|
||||||
|
|
||||||
const Settings = memo(({productData}) => {
|
const Settings = memo(({productData}) => {
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ const Settings = memo(({productData}) => {
|
|||||||
})
|
})
|
||||||
const settingsConfig = configData?.data?.settings_items
|
const settingsConfig = configData?.data?.settings_items
|
||||||
// console.log('CONFIG DATA...', settingsConfig)
|
// console.log('CONFIG DATA...', settingsConfig)
|
||||||
|
// console.log('configData', configData?.data?.subscription_template)
|
||||||
|
|
||||||
const [fieldsChanged, setFieldsChanged] = useState(false)
|
const [fieldsChanged, setFieldsChanged] = useState(false)
|
||||||
|
|
||||||
@@ -81,12 +82,12 @@ const Settings = memo(({productData}) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
<div className="tab tab-vertical">
|
<div className="d-flex">
|
||||||
<ul className="nav nav-tabs" role="tablist">
|
<ul className="bg-body-secondary flex-column nav" role="tablist" style={{width: '25%', minHeight: '670px', maxHeight: '670px'}}>
|
||||||
<>
|
<>
|
||||||
{Object.entries(sortedSettingsConfig).map(([key, value], index) => (
|
{Object.entries(sortedSettingsConfig).map(([key, value], index) => (
|
||||||
<li key={key} className="nav-item">
|
<li key={key} className="nav-item">
|
||||||
<a className={`nav-link ${(activeTab == value.controls || (index == 0 & !activeTab)) && 'active show'}`}
|
<p className={`text-black nav-link ${(activeTab == value.controls || (index == 0 & !activeTab)) && 'active show bg-primary text-white'}`}
|
||||||
id={key}
|
id={key}
|
||||||
// data-bs-toggle="pill"
|
// data-bs-toggle="pill"
|
||||||
// data-bs-target={`#${value.controls}`}
|
// data-bs-target={`#${value.controls}`}
|
||||||
@@ -97,12 +98,27 @@ const Settings = memo(({productData}) => {
|
|||||||
onClick={()=>handleChangeTab(value.controls)}
|
onClick={()=>handleChangeTab(value.controls)}
|
||||||
>
|
>
|
||||||
{value.title}
|
{value.title}
|
||||||
</a>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
{configData?.data?.subscription_template &&
|
||||||
|
<li className="mt-auto nav-item">
|
||||||
|
<p className={`text-black nav-link ${(activeTab == 'config_temp') && 'active show bg-primary text-white'}`}
|
||||||
|
// data-bs-toggle="pill"
|
||||||
|
// data-bs-target={`#${value.controls}`}
|
||||||
|
type="button"
|
||||||
|
// role="tab"
|
||||||
|
// aria-controls={value.controls}
|
||||||
|
// aria-selected="true"
|
||||||
|
onClick={()=>handleChangeTab('config_temp')}
|
||||||
|
>
|
||||||
|
Configure Template
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
</ul>
|
</ul>
|
||||||
<div className="tab-content">
|
<div className="p-3 tab-content" style={{width: '75%'}}>
|
||||||
<>
|
<>
|
||||||
{Object.entries(sortedSettingsConfig).map(([key, value], index) => (
|
{Object.entries(sortedSettingsConfig).map(([key, value], index) => (
|
||||||
<div key={key} className={`tab-pane fade ${(activeTab == value.controls || (index == 0 & !activeTab)) && 'active show'}`}
|
<div key={key} className={`tab-pane fade ${(activeTab == value.controls || (index == 0 & !activeTab)) && 'active show'}`}
|
||||||
@@ -112,6 +128,10 @@ const Settings = memo(({productData}) => {
|
|||||||
<GeneralTab tabKey={key} name={value.title} data={value.data} isCustom={value.custom} productData={productData} backendValues={settingsData} setFieldsChanged={setFieldsChanged} />
|
<GeneralTab tabKey={key} name={value.title} data={value.data} isCustom={value.custom} productData={productData} backendValues={settingsData} setFieldsChanged={setFieldsChanged} />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
<div className={`tab-pane fade ${(activeTab == 'config_temp') && 'active show'}`}
|
||||||
|
>
|
||||||
|
<TemplateConfigure productData={productData} />
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
import React, {memo, useState} from 'react'
|
||||||
|
import getImage from "../../../utils/getImage";
|
||||||
|
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query';
|
||||||
|
import queryKeys from '../../../services/queryKeys';
|
||||||
|
import {getTemplateConfig} from '../../../services/services';
|
||||||
|
import {Link} from "react-router-dom";
|
||||||
|
import siteLinks from "../../../links/siteLinks";
|
||||||
|
import UploadModal from './UploadModal';
|
||||||
|
|
||||||
|
const TemplateConfigure = ({productData}) => {
|
||||||
|
|
||||||
|
// /panel/myproduct/template-config
|
||||||
|
|
||||||
|
const queryClient = useQueryClient()
|
||||||
|
|
||||||
|
const {data: templateData, isFetching, isError, error} = useQuery({
|
||||||
|
queryKey: queryKeys.myTemplateConfig,
|
||||||
|
queryFn: () => {
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid'), // USER UID
|
||||||
|
product_id: productData?.product_id
|
||||||
|
}
|
||||||
|
return getTemplateConfig(reqData)
|
||||||
|
},
|
||||||
|
staleTime: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const templateResponse = templateData?.data
|
||||||
|
const templateImages = templateResponse?.template_images?.data;
|
||||||
|
// debugger;
|
||||||
|
console.log("templateResponse", templateResponse);
|
||||||
|
// const currentColorUID = templateResponse?.current_colorstyle_uid
|
||||||
|
// const color_styles = templateResponse?.color_styles
|
||||||
|
// const custom_template_name = templateResponse?.custom_template_name
|
||||||
|
|
||||||
|
return <>
|
||||||
|
<div className="card card-statistics">
|
||||||
|
{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="card-header">
|
||||||
|
<div className="card-heading">
|
||||||
|
<h4 className="card-title"
|
||||||
|
style={{textTransform: 'none'}}>{templateResponse?.template_name}</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div className="col-12">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<h4>Image List</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul className="list-unstyled">
|
||||||
|
{templateImages && templateImages.map(
|
||||||
|
(item) => {
|
||||||
|
const currImage = item?.default_val;
|
||||||
|
return (
|
||||||
|
<li className="media">
|
||||||
|
<div style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row',
|
||||||
|
padding: '5px',
|
||||||
|
backgroundColor: 'aliceblue',
|
||||||
|
margin: '2px',
|
||||||
|
maxHeight: '150px'
|
||||||
|
}}>
|
||||||
|
<div className='d-flex justify-content-center align-items-center' style={{padding: '6px', width: '120px', height: '100px'}}>
|
||||||
|
<img className="mb-xxs-0 img-fluid"
|
||||||
|
style={{height: 'auto', maxHeight: '100px'}}
|
||||||
|
src={currImage} alt="image"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="media-body" style={{padding: '2px'}}>
|
||||||
|
<div style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column'
|
||||||
|
}}>
|
||||||
|
<div style={{textAlign: 'right',width: '100%'}}></div>
|
||||||
|
{/* [Change Image] */}
|
||||||
|
<label className='w-100 text-end' data-bs-toggle="modal" data-bs-target="#verticalCenter" style={{cursor: 'pointer'}}>[Change Image]</label>
|
||||||
|
{/* <input id={item?.id} name={item?.id} className="d-none form-control form-control-sm" type="file" onChange={handleFileChange}/> */}
|
||||||
|
<div>
|
||||||
|
<h5 className="mt-0 mb-1">{item?.name}</h5>
|
||||||
|
{item?.description}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</>
|
||||||
|
|
||||||
|
|
||||||
|
} </div>
|
||||||
|
<UploadModal />
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default TemplateConfigure
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
import React, { useRef, useState } from 'react'
|
||||||
|
import { Modal } from "bootstrap";
|
||||||
|
import {useMutation, useQuery, useQueryClient} from '@tanstack/react-query';
|
||||||
|
import queryKeys from '../../../services/queryKeys';
|
||||||
|
import {getMediaFileList, getTemplateConfig, uploadFile} from '../../../services/services';
|
||||||
|
|
||||||
|
export default function UploadModal() {
|
||||||
|
|
||||||
|
const [selectedFiles, setSelectedFiles] = useState([])
|
||||||
|
|
||||||
|
const handleSelectedFiles = (file_uid) => {
|
||||||
|
if(selectedFiles.length && selectedFiles.includes(file_uid)){
|
||||||
|
let indexOfItem = selectedFiles.indexOf(file_uid)
|
||||||
|
let oldFiles = [...selectedFiles]
|
||||||
|
oldFiles.splice(indexOfItem, 1)
|
||||||
|
setSelectedFiles(oldFiles)
|
||||||
|
}else{
|
||||||
|
setSelectedFiles(prev => [...prev, file_uid])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const modalRef = useRef(null)
|
||||||
|
|
||||||
|
const dismissModal = () => {
|
||||||
|
const body = document.querySelector('body')
|
||||||
|
body.removeAttribute('style')
|
||||||
|
// body.classList.toggle('modal-open')
|
||||||
|
|
||||||
|
const modalBackdrop = document.querySelectorAll('.modal-backdrop')
|
||||||
|
modalBackdrop.forEach(item => {
|
||||||
|
if (item) {
|
||||||
|
item.remove();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const modal = Modal.getInstance(modalRef.current);
|
||||||
|
modal && modal.hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
const uploadFileMutation = useMutation({
|
||||||
|
mutationFn: (fields) => {
|
||||||
|
if(!fields.file){
|
||||||
|
throw({message: 'Please select a file first!'})
|
||||||
|
}
|
||||||
|
// return uploadFile(fields)
|
||||||
|
// remember to close the modal
|
||||||
|
dismissModal()
|
||||||
|
setTimeout(()=>{
|
||||||
|
uploadFileMutation.reset()
|
||||||
|
}, 3000)
|
||||||
|
},
|
||||||
|
onSuccess: (res) => {
|
||||||
|
// console.log('res', res.data)
|
||||||
|
// if(res.data.resultCode != '0' || !res?.data?.pending_uid){
|
||||||
|
// throw({message: res?.data?.resultDescription})
|
||||||
|
// }
|
||||||
|
// setSelectedFile({id: '', img: ''})
|
||||||
|
// queryClient.refetchQueries({
|
||||||
|
// queryKey: [...queryKeys.my_files],
|
||||||
|
// type: 'active',
|
||||||
|
// exact: true,
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
onSettled: () => {
|
||||||
|
setTimeout(()=>{
|
||||||
|
uploadFileMutation.reset()
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleUpload = () => {
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem("token"), // USER TOKEN
|
||||||
|
member_uid: localStorage.getItem("uid"), // USER UID
|
||||||
|
// file: selectedFile?.img
|
||||||
|
};
|
||||||
|
uploadFileMutation.mutate(reqData)
|
||||||
|
}
|
||||||
|
|
||||||
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
|
queryKey: queryKeys.my_files,
|
||||||
|
queryFn: () => {
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid') // USER UID
|
||||||
|
}
|
||||||
|
return getMediaFileList(reqData)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const mediaFileList = data?.data
|
||||||
|
// console.log('mediaFileList', mediaFileList) //file_list
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* Vertical Center Modal */}
|
||||||
|
<div ref={modalRef} className="modal fade" id="verticalCenter" tabIndex="-1" role="dialog" aria-hidden="false">
|
||||||
|
<div className="modal-50 modal-dialog modal-dialog-centered modal-50" role="document">
|
||||||
|
<div className="modal-content">
|
||||||
|
<div className="modal-header">
|
||||||
|
<h5 className="modal-title" style={{fontSize: '18px'}} id="verticalCenterTitle">Select New Picture</h5>
|
||||||
|
<button type="button" className="close" data-bs-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="modal-body">
|
||||||
|
{isFetching ?
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-mute'>Loading...</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
: isError ?
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-danger'>{error?.message}</p>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
|
<div className='row g-5 justify-content-center'>
|
||||||
|
{mediaFileList?.file_list?.length ?
|
||||||
|
<>
|
||||||
|
{mediaFileList?.file_list?.map(item => {
|
||||||
|
const file_url = (mediaFileList?.media_server + "/" + item?.file_group + "/" + item?.file_uid + "/" + item.filename).toLowerCase();
|
||||||
|
return(
|
||||||
|
<div onClick={()=>handleSelectedFiles(item?.file_uid)} className={`p-3 text-center col-4`} style={{cursor: 'pointer'}}>
|
||||||
|
<div className={`p-3 ${selectedFiles.includes(item?.file_uid) && 'bg-light'}`}>
|
||||||
|
<img key={item?.file_uid} className="img-fluid" src={file_url} alt='file-image' />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
:
|
||||||
|
<p>No File(s) found!</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
{/* <div style={{fontSize: '18px'}} className="" dangerouslySetInnerHTML={{__html: saleText}}/> */}
|
||||||
|
{/* {mutation.error &&
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-danger'>{mutation.error.message}</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
{mutation.isSuccess &&
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-success'>{'subscription is successful'}</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
} */}
|
||||||
|
|
||||||
|
{/* {requestStatus.message && (
|
||||||
|
<div className="col-12">
|
||||||
|
<p className={`p-2 text-center ${requestStatus.status ? 'text-success' : 'text-danger'}`}>{requestStatus.message}</p>
|
||||||
|
</div>
|
||||||
|
)} */}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div className="modal-footer">
|
||||||
|
<button type="button" className="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
|
||||||
|
{selectedFiles.length > 0 &&
|
||||||
|
<button type="button" className="btn btn-primary" disabled={uploadFileMutation?.isPending || uploadFileMutation?.isSuccess} onClick={handleUpload}>{uploadFileMutation?.isPending ? 'Upload...' : uploadFileMutation?.isSuccess ? 'Uploaded' : 'Upload'}</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* END of Vertical Center Modal */}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,7 +1,27 @@
|
|||||||
import React from "react";
|
import React, { useState } from "react";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { getPaymentReports } from "../../services/services";
|
||||||
|
import queryKeys from "../../services/queryKeys";
|
||||||
|
|
||||||
export default function PaymentReportTable() {
|
export default function PaymentReportTable() {
|
||||||
return (<>
|
|
||||||
|
const [page, setPage] = useState(0)
|
||||||
|
|
||||||
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
|
queryKey: [...queryKeys.payment_report, page],
|
||||||
|
queryFn: () => {
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid'), // USER UID
|
||||||
|
page
|
||||||
|
}
|
||||||
|
return getPaymentReports(reqData)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('DATA', data?.data)
|
||||||
|
return (
|
||||||
|
<>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-md-12 m-b-30">
|
<div className="col-md-12 m-b-30">
|
||||||
<div className="d-block d-sm-flex flex-nowrap align-items-center">
|
<div className="d-block d-sm-flex flex-nowrap align-items-center">
|
||||||
@@ -12,6 +32,17 @@ export default function PaymentReportTable() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
|
{isFetching ?
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-mute'>Loading...</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
: isError ?
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-danger'>{error?.message}</p>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
<div className="col-lg-12">
|
<div className="col-lg-12">
|
||||||
<div className="card card-statistics">
|
<div className="card card-statistics">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
@@ -164,7 +195,8 @@ export default function PaymentReportTable() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
|
</div>
|
||||||
</>)
|
</>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,28 @@
|
|||||||
import React from "react";
|
import React, { useState } from "react";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { getProductReports } from "../../services/services";
|
||||||
|
import queryKeys from "../../services/queryKeys";
|
||||||
|
|
||||||
export default function ProductReportTable() {
|
export default function ProductReportTable() {
|
||||||
return (<>
|
|
||||||
|
const [page, setPage] = useState(0)
|
||||||
|
|
||||||
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
|
queryKey: [...queryKeys.product_report, page],
|
||||||
|
queryFn: () => {
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid'), // USER UID
|
||||||
|
page
|
||||||
|
}
|
||||||
|
return getProductReports(reqData)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('DATA', data?.data)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-md-12 m-b-30">
|
<div className="col-md-12 m-b-30">
|
||||||
@@ -14,6 +35,17 @@ export default function ProductReportTable() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
|
{isFetching ?
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-mute'>Loading...</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
: isError ?
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-danger'>{error?.message}</p>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
<div className="col-lg-12">
|
<div className="col-lg-12">
|
||||||
<div className="card card-statistics">
|
<div className="card card-statistics">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
@@ -166,7 +198,8 @@ export default function ProductReportTable() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
|
</div>
|
||||||
</>)
|
</>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -36,6 +36,17 @@ export default function Reports() {
|
|||||||
<>
|
<>
|
||||||
<BreadcrumbComBS title='Reports' paths={['Dashboard', 'Reports']}/>
|
<BreadcrumbComBS title='Reports' paths={['Dashboard', 'Reports']}/>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
|
{isFetching ?
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-mute'>Loading...</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
: isError ?
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-danger'>{error?.message}</p>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<div className="card card-statistics" style={{minHeight: '550px'}}>
|
<div className="card card-statistics" style={{minHeight: '550px'}}>
|
||||||
@@ -75,6 +86,7 @@ export default function Reports() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,28 @@
|
|||||||
import React from "react";
|
import React, { useState } from "react";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import { getSystemReports } from "../../services/services";
|
||||||
|
import queryKeys from "../../services/queryKeys";
|
||||||
|
|
||||||
export default function SystemReportTable() {
|
export default function SystemReportTable() {
|
||||||
return (<>
|
|
||||||
|
const [page, setPage] = useState(0)
|
||||||
|
|
||||||
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
|
queryKey: [...queryKeys.system_report, page],
|
||||||
|
queryFn: () => {
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid'), // USER UID
|
||||||
|
page
|
||||||
|
}
|
||||||
|
return getSystemReports(reqData)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('DATA', data?.data)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-md-12 m-b-30">
|
<div className="col-md-12 m-b-30">
|
||||||
@@ -14,6 +35,17 @@ export default function SystemReportTable() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
|
{isFetching ?
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-mute'>Loading...</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
: isError ?
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-danger'>{error?.message}</p>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
<div className="col-lg-12">
|
<div className="col-lg-12">
|
||||||
<div className="card card-statistics">
|
<div className="card card-statistics">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
@@ -166,7 +198,8 @@ export default function SystemReportTable() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
|
</div>
|
||||||
</>)
|
</>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -8,11 +8,15 @@ const queryKeys = {
|
|||||||
recentAction: ['recent-action'],
|
recentAction: ['recent-action'],
|
||||||
settingsData: ['settings_data'],
|
settingsData: ['settings_data'],
|
||||||
myProductConfig: ['myproduct_config'],
|
myProductConfig: ['myproduct_config'],
|
||||||
|
myTemplateConfig: ['mytemplate_config'],
|
||||||
productTemplateData: ['product_template_data'],
|
productTemplateData: ['product_template_data'],
|
||||||
subscriptions: ['subscriptions'],
|
subscriptions: ['subscriptions'],
|
||||||
profile_data: ['profile_data'],
|
profile_data: ['profile_data'],
|
||||||
my_files: ['my_files'],
|
my_files: ['my_files'],
|
||||||
topics: ['topics'],
|
topics: ['topics'],
|
||||||
|
payment_report: ['payment_report'],
|
||||||
|
product_report: ['product_report'],
|
||||||
|
system_report: ['system_report'],
|
||||||
|
|
||||||
dashboard: ['dashboard'],
|
dashboard: ['dashboard'],
|
||||||
topBar: ['top-bar'],
|
topBar: ['top-bar'],
|
||||||
|
|||||||
@@ -244,6 +244,14 @@ export const getProductColorStyles = (reqData) => {
|
|||||||
}
|
}
|
||||||
return postAuxEnd(`/panel/account/products/color-styles`, postData, false)
|
return postAuxEnd(`/panel/account/products/color-styles`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getTemplateConfig = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/myproduct/template-config`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION TO ACTIVATE TEMPLATE
|
// FUNCTION TO ACTIVATE TEMPLATE
|
||||||
export const activateTemplate = (reqData) => {
|
export const activateTemplate = (reqData) => {
|
||||||
let postData = {
|
let postData = {
|
||||||
@@ -297,6 +305,30 @@ export const getReportsTopicsList = (reqData) => {
|
|||||||
return postAuxEnd(`/panel/report/topics`, postData, false)
|
return postAuxEnd(`/panel/report/topics`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET PAYMENT REPORTS
|
||||||
|
export const getPaymentReports = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/report/item/payment`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET PRODUCT REPORTS
|
||||||
|
export const getProductReports = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/report/item/product`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET SYSTEM REPORTS
|
||||||
|
export const getSystemReports = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/report/item/system`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION TO GET COMMON PRACTICE
|
// FUNCTION TO GET COMMON PRACTICE
|
||||||
export const getCommonPractice = (reqData) => {
|
export const getCommonPractice = (reqData) => {
|
||||||
let postData = {
|
let postData = {
|
||||||
|
|||||||
Reference in New Issue
Block a user