|
|
@ -1,6 +1,6 @@ |
|
|
|
import React, { useRef, useState } from "react"; |
|
|
|
import React, { useRef, useState } from "react"; |
|
|
|
|
|
|
|
|
|
|
|
import BasicTable from "./BasicTable"; |
|
|
|
import BasicTable from "./BasicTable"; |
|
|
|
// import useDraggableScroll from "use-draggable-scroll";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cancleIcon from "./zarbedar-icon.svg"; |
|
|
|
import cancleIcon from "./zarbedar-icon.svg"; |
|
|
|
|
|
|
|
|
|
|
@ -8,9 +8,12 @@ const ReactTable4 = ({ breadCrumbs, subTitle, title }) => { |
|
|
|
const [tabs, setTabs] = useState([ |
|
|
|
const [tabs, setTabs] = useState([ |
|
|
|
{ name: "جدول " + breadCrumbs[breadCrumbs.length - 1].name, id: 0 }, |
|
|
|
{ name: "جدول " + breadCrumbs[breadCrumbs.length - 1].name, id: 0 }, |
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
let [activeTab, setActivateTab] = useState(0); |
|
|
|
let [activeTab, setActivateTab] = useState(0); |
|
|
|
|
|
|
|
|
|
|
|
const stateRef = useRef(); |
|
|
|
const stateRef = useRef(); |
|
|
|
const stateActiveRef = useRef(); |
|
|
|
const stateActiveRef = useRef(); |
|
|
|
|
|
|
|
|
|
|
|
stateRef.current = tabs; |
|
|
|
stateRef.current = tabs; |
|
|
|
stateActiveRef.current = activeTab; |
|
|
|
stateActiveRef.current = activeTab; |
|
|
|
|
|
|
|
|
|
|
@ -19,6 +22,7 @@ const ReactTable4 = ({ breadCrumbs, subTitle, title }) => { |
|
|
|
if (stateRef.current.find((e) => e.id === newTab.id)) return; |
|
|
|
if (stateRef.current.find((e) => e.id === newTab.id)) return; |
|
|
|
setTabs([...stateRef.current, newTab]); |
|
|
|
setTabs([...stateRef.current, newTab]); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const delTab = (id) => { |
|
|
|
const delTab = (id) => { |
|
|
|
setTabs(stateRef.current.filter((e) => e.id != id)); |
|
|
|
setTabs(stateRef.current.filter((e) => e.id != id)); |
|
|
|
if (stateActiveRef.current == id) setActivateTab(0); |
|
|
|
if (stateActiveRef.current == id) setActivateTab(0); |
|
|
@ -55,7 +59,7 @@ const ReactTable4 = ({ breadCrumbs, subTitle, title }) => { |
|
|
|
<div className="w-1 h-5 bg-blue-500 rounded ml-1"></div> |
|
|
|
<div className="w-1 h-5 bg-blue-500 rounded ml-1"></div> |
|
|
|
<h2 className="text-base text-blue-900">{title}</h2> |
|
|
|
<h2 className="text-base text-blue-900">{title}</h2> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/* page Title */} |
|
|
|
{/* page subTitle */} |
|
|
|
<div className="flex flex-row items-center mt-4"> |
|
|
|
<div className="flex flex-row items-center mt-4"> |
|
|
|
<div className="w-1 h-5 bg-gray-400 rounded ml-1"></div> |
|
|
|
<div className="w-1 h-5 bg-gray-400 rounded ml-1"></div> |
|
|
|
<h2 className="text-xs">{subTitle}</h2> |
|
|
|
<h2 className="text-xs">{subTitle}</h2> |
|
|
@ -72,7 +76,9 @@ const ReactTable4 = ({ breadCrumbs, subTitle, title }) => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
window.isDown = false; |
|
|
|
window.isDown = false; |
|
|
|
|
|
|
|
|
|
|
|
export default ReactTable4; |
|
|
|
export default ReactTable4; |
|
|
|
|
|
|
|
|
|
|
|
export function Tabbar({ tabs, delTab, setActivateTab, activeTab }) { |
|
|
|
export function Tabbar({ tabs, delTab, setActivateTab, activeTab }) { |
|
|
@ -109,14 +115,13 @@ export function Tabbar({ tabs, delTab, setActivateTab, activeTab }) { |
|
|
|
if (window.isDown) return e.preventDefault(); |
|
|
|
if (window.isDown) return e.preventDefault(); |
|
|
|
}} |
|
|
|
}} |
|
|
|
aria-current="page" |
|
|
|
aria-current="page" |
|
|
|
className="flex flex-row items-center text-sm text-center active px-4 rounded-sm mx-1" |
|
|
|
className="flex flex-row items-center text-sm text-center active rounded-sm px-4" |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
backgroundColor: activeTab === el.id ? "#92c1fc" : "#F1F6FF", |
|
|
|
backgroundColor: activeTab === el.id ? "#92c1fc" : "#F1F6FF", |
|
|
|
|
|
|
|
|
|
|
|
color: activeTab === el.id ? "#fff" : "#000", |
|
|
|
color: activeTab === el.id ? "#fff" : "#000", |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
<div className="h-full py-4" onClick={(e) => setActivateTab(el.id)}> |
|
|
|
<div className="h-full py-2" onClick={(e) => setActivateTab(el.id)}> |
|
|
|
{el.name} |
|
|
|
{el.name} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{el.id ? ( |
|
|
|
{el.id ? ( |
|
|
|