inboxlookup_screen 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/Service/OrdersMasterDetail.js +157 -160
package/package.json
CHANGED
|
@@ -17,7 +17,6 @@ import 'devextreme/dist/css/dx.light.css';
|
|
|
17
17
|
const OrdersMasterDetail = ({ dataSource, keyExpr, token, BaseUrl, ProjectId }) => {
|
|
18
18
|
const [orders, setOrders] = useState([]);
|
|
19
19
|
const [selectedOrder, setSelectedOrder] = useState(null);
|
|
20
|
-
const saveButtonRef = useRef(null);
|
|
21
20
|
const [rowDetailsVisible, setRowDetailsVisible] = useState(false);
|
|
22
21
|
const [selectedRow, setSelectedRow] = useState(null);
|
|
23
22
|
const [searchText, setSearchText] = useState("");
|
|
@@ -51,8 +50,6 @@ const OrdersMasterDetail = ({ dataSource, keyExpr, token, BaseUrl, ProjectId })
|
|
|
51
50
|
|
|
52
51
|
// RIGHT SIDE SEARCH
|
|
53
52
|
const [gridSearchText, setGridSearchText] = useState("");
|
|
54
|
-
const [searchHistory, setSearchHistory] = useState([]);
|
|
55
|
-
const searchHistoryRef = useRef([]);
|
|
56
53
|
|
|
57
54
|
|
|
58
55
|
useEffect(() => {
|
|
@@ -92,7 +89,6 @@ const OrdersMasterDetail = ({ dataSource, keyExpr, token, BaseUrl, ProjectId })
|
|
|
92
89
|
setFilteredOrders([]);
|
|
93
90
|
|
|
94
91
|
setSelectedOrder(null);
|
|
95
|
-
setSelectedService(null);
|
|
96
92
|
|
|
97
93
|
setGridStore(null);
|
|
98
94
|
setColumns([]);
|
|
@@ -540,26 +536,6 @@ const OrdersMasterDetail = ({ dataSource, keyExpr, token, BaseUrl, ProjectId })
|
|
|
540
536
|
};
|
|
541
537
|
|
|
542
538
|
|
|
543
|
-
useEffect(() => {
|
|
544
|
-
const handleVisibilityChange = () => {
|
|
545
|
-
if (document.visibilityState === "hidden") {
|
|
546
|
-
updateSearchHistoryAPI();
|
|
547
|
-
}
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
const handleBeforeUnload = () => {
|
|
551
|
-
updateSearchHistoryAPI();
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
555
|
-
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
556
|
-
|
|
557
|
-
return () => {
|
|
558
|
-
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
559
|
-
window.removeEventListener("beforeunload", handleBeforeUnload);
|
|
560
|
-
};
|
|
561
|
-
}, []);
|
|
562
|
-
|
|
563
539
|
const applySearch = () => {
|
|
564
540
|
if (!gridInstance) return;
|
|
565
541
|
|
|
@@ -641,156 +617,177 @@ const OrdersMasterDetail = ({ dataSource, keyExpr, token, BaseUrl, ProjectId })
|
|
|
641
617
|
|
|
642
618
|
{/* RIGHT PANEL (SEARCH + HISTORY) */}
|
|
643
619
|
<div className="lookupscreen-right">
|
|
644
|
-
{
|
|
645
|
-
<div className="
|
|
646
|
-
|
|
647
|
-
<
|
|
648
|
-
|
|
620
|
+
{orders.length === 0 ? (
|
|
621
|
+
<div className="lookupscreen-empty-state">
|
|
622
|
+
<div className="empty-icon">🚫</div>
|
|
623
|
+
<h3>No services available</h3>
|
|
624
|
+
<p>
|
|
625
|
+
There are no services configured for this project.
|
|
626
|
+
<br />
|
|
627
|
+
Please contact the administrator or add a new service.
|
|
628
|
+
</p>
|
|
629
|
+
</div>
|
|
630
|
+
)
|
|
631
|
+
|
|
632
|
+
/* 2️⃣ Services exist, but none selected */
|
|
633
|
+
: !selectedOrder ? (
|
|
634
|
+
<div className="lookupscreen-empty-state">
|
|
635
|
+
<div className="empty-icon">📄</div>
|
|
636
|
+
<h3>No service selected</h3>
|
|
637
|
+
<p>Please select a service from the left panel to view sheet details.</p>
|
|
649
638
|
</div>
|
|
639
|
+
)
|
|
650
640
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
<
|
|
656
|
-
|
|
657
|
-
<input
|
|
658
|
-
type="text"
|
|
659
|
-
className="lookupscreen-searchcontrol"
|
|
660
|
-
placeholder="Search here..."
|
|
661
|
-
value={searchText}
|
|
662
|
-
onChange={(e) => {
|
|
663
|
-
setSearchText(e.target.value)
|
|
664
|
-
handleSearchChange(e.target.value)
|
|
665
|
-
}}
|
|
666
|
-
/>
|
|
641
|
+
/* 3️⃣ Service selected */
|
|
642
|
+
: (<div className="lookupscreenexcel-card">
|
|
643
|
+
{/* Header */}
|
|
644
|
+
<div className="lookupscreenexcel-header">
|
|
645
|
+
<h2>Sheet Name: {selectedOrder.sheetName}</h2>
|
|
646
|
+
</div>
|
|
667
647
|
|
|
668
|
-
|
|
648
|
+
<div className="lookupscreensearchbox">
|
|
649
|
+
<div className="lookupscreensearch">
|
|
669
650
|
|
|
651
|
+
{/* SEARCH TEXT */}
|
|
652
|
+
<div className="lookupscreenlevellist first">
|
|
653
|
+
<label>What are you looking for?</label>
|
|
654
|
+
<input
|
|
655
|
+
type="text"
|
|
656
|
+
className="lookupscreen-searchcontrol"
|
|
657
|
+
placeholder="Search here..."
|
|
658
|
+
value={searchText}
|
|
659
|
+
onChange={(e) => {
|
|
660
|
+
setSearchText(e.target.value)
|
|
661
|
+
handleSearchChange(e.target.value)
|
|
662
|
+
}}
|
|
663
|
+
/>
|
|
670
664
|
|
|
665
|
+
</div>
|
|
671
666
|
|
|
672
|
-
{/* SEARCH BUTTON */}
|
|
673
|
-
<div className="lookupscreenlevellist action" onClick={applySearch}>
|
|
674
|
-
<button className="lookupscreenbutton">SEARCH</button>
|
|
675
667
|
|
|
676
|
-
</div>
|
|
677
668
|
|
|
669
|
+
{/* SEARCH BUTTON */}
|
|
670
|
+
<div className="lookupscreenlevellist action" onClick={applySearch}>
|
|
671
|
+
<button className="lookupscreenbutton">SEARCH</button>
|
|
672
|
+
|
|
673
|
+
</div>
|
|
674
|
+
|
|
675
|
+
</div>
|
|
678
676
|
</div>
|
|
679
|
-
</div>
|
|
680
677
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
678
|
+
<DataGrid
|
|
679
|
+
ref={gridRef}
|
|
680
|
+
dataSource={gridStore}
|
|
681
|
+
keyExpr={keyExpr}
|
|
682
|
+
onInitialized={(e) => setGridInstance(e.component)}
|
|
683
|
+
remoteOperations={true} // KEEP TRUE for remote paging, etc.
|
|
684
|
+
height="80%"
|
|
685
|
+
width="100%" // ✅ Set width to allow layout
|
|
686
|
+
columnAutoWidth={true} // ✅ Adjust columns automatically
|
|
687
|
+
showBorders={true}
|
|
688
|
+
allowColumnReordering={true}
|
|
689
|
+
onColumnReordered={(e) => {
|
|
690
|
+
|
|
691
|
+
}}
|
|
692
|
+
// onColumnReordered={handleColumnReorder}
|
|
693
|
+
columnHidingEnabled={false}
|
|
694
|
+
onSelectionChanged={onSelectionChanged}
|
|
695
|
+
repaintChangesOnly={true}
|
|
696
|
+
columns={columns}
|
|
697
|
+
onOptionChanged={(e) => {
|
|
698
|
+
if (e.name === "grouping" && e.fullName === "grouping.groupedColumns") {
|
|
699
|
+
setAutoExpandAll(false);
|
|
700
|
+
if (gridInstance) {
|
|
701
|
+
gridInstance.collapseAll(-1); // 👈 collapses all groups
|
|
702
|
+
}
|
|
705
703
|
}
|
|
706
|
-
}
|
|
707
|
-
}}
|
|
708
|
-
onRowClick={(e) => {
|
|
709
|
-
setSelectedRow(e.data); // 🔥 full row object
|
|
710
|
-
setRowDetailsVisible(true); // 🔥 open popup
|
|
711
|
-
}}
|
|
712
|
-
onContentReady={(e) => {
|
|
713
|
-
onContentReady(e.component)
|
|
714
|
-
// setGridInstance(e.component); // ensure grid instance is always updated
|
|
715
|
-
|
|
716
|
-
if (!readOnlyFilters) return;
|
|
717
|
-
const rootElement = e.component.element();
|
|
718
|
-
|
|
719
|
-
// Disable filter row inputs
|
|
720
|
-
const filterRowInputs = rootElement.querySelectorAll(".dx-datagrid-filter-row input");
|
|
721
|
-
filterRowInputs.forEach((input) => {
|
|
722
|
-
input.readOnly = true;
|
|
723
|
-
input.style.backgroundColor = "#f5f5f5";
|
|
724
|
-
|
|
725
|
-
});
|
|
726
|
-
const headerIcons = rootElement.querySelectorAll(".dx-header-filter");
|
|
727
|
-
headerIcons.forEach((icon) => {
|
|
728
|
-
icon.style.pointerEvents = "none";
|
|
729
|
-
icon.style.opacity = "0.5";
|
|
730
|
-
icon.setAttribute("aria-disabled", "true");
|
|
731
|
-
icon.setAttribute("tabindex", "-1");
|
|
732
|
-
|
|
733
|
-
});
|
|
734
|
-
}}
|
|
735
|
-
>
|
|
736
|
-
<Selection
|
|
737
|
-
mode="multiple"
|
|
738
|
-
showCheckBoxesMode={showCheckboxes ? 'always' : 'none'} // toggle here
|
|
739
|
-
selectAllMode="page" // This shows the checkbox in header
|
|
740
|
-
/>
|
|
741
|
-
<GroupPanel visible={true}
|
|
742
|
-
emptyPanelText="Use the context menu of header columns to group data"
|
|
743
|
-
/>
|
|
744
|
-
{/* <SearchPanel visible={true} highlightCaseSensitive={false} /> */}
|
|
745
|
-
|
|
746
|
-
<Grouping autoExpandAll={false} contextMenuEnabled={true} expandMode="rowClick"
|
|
747
|
-
/>
|
|
748
|
-
<FilterRow visible={true} />
|
|
749
|
-
<HeaderFilter visible={true} />
|
|
750
|
-
|
|
751
|
-
<Scrolling mode="virtual" useNative={false} />
|
|
752
|
-
<Summary>
|
|
753
|
-
<TotalItem column="sheetId" summaryType="count" displayFormat="Total: {0}" />
|
|
754
|
-
<GroupItem column="sheetId" summaryType="count" displayFormat="Count: {0}" />
|
|
755
|
-
</Summary>
|
|
756
|
-
|
|
757
|
-
</DataGrid>
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
{selectedRow && (
|
|
761
|
-
<Popup
|
|
762
|
-
visible={rowDetailsVisible}
|
|
763
|
-
onHiding={() => setRowDetailsVisible(false)}
|
|
764
|
-
showTitle
|
|
765
|
-
title={`Row Details`}
|
|
766
|
-
dragEnabled={false}
|
|
767
|
-
closeOnOutsideClick
|
|
768
|
-
showCloseButton
|
|
769
|
-
width={420}
|
|
770
|
-
height="100%"
|
|
771
|
-
position={{
|
|
772
|
-
my: "right top",
|
|
773
|
-
at: "right top",
|
|
774
|
-
of: window,
|
|
775
704
|
}}
|
|
776
|
-
|
|
705
|
+
onRowClick={(e) => {
|
|
706
|
+
setSelectedRow(e.data); // 🔥 full row object
|
|
707
|
+
setRowDetailsVisible(true); // 🔥 open popup
|
|
708
|
+
}}
|
|
709
|
+
onContentReady={(e) => {
|
|
710
|
+
onContentReady(e.component)
|
|
711
|
+
// setGridInstance(e.component); // ensure grid instance is always updated
|
|
712
|
+
|
|
713
|
+
if (!readOnlyFilters) return;
|
|
714
|
+
const rootElement = e.component.element();
|
|
715
|
+
|
|
716
|
+
// Disable filter row inputs
|
|
717
|
+
const filterRowInputs = rootElement.querySelectorAll(".dx-datagrid-filter-row input");
|
|
718
|
+
filterRowInputs.forEach((input) => {
|
|
719
|
+
input.readOnly = true;
|
|
720
|
+
input.style.backgroundColor = "#f5f5f5";
|
|
721
|
+
|
|
722
|
+
});
|
|
723
|
+
const headerIcons = rootElement.querySelectorAll(".dx-header-filter");
|
|
724
|
+
headerIcons.forEach((icon) => {
|
|
725
|
+
icon.style.pointerEvents = "none";
|
|
726
|
+
icon.style.opacity = "0.5";
|
|
727
|
+
icon.setAttribute("aria-disabled", "true");
|
|
728
|
+
icon.setAttribute("tabindex", "-1");
|
|
729
|
+
|
|
730
|
+
});
|
|
731
|
+
}}
|
|
777
732
|
>
|
|
778
|
-
<
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
733
|
+
<Selection
|
|
734
|
+
mode="multiple"
|
|
735
|
+
showCheckBoxesMode={showCheckboxes ? 'always' : 'none'} // toggle here
|
|
736
|
+
selectAllMode="page" // This shows the checkbox in header
|
|
737
|
+
/>
|
|
738
|
+
<GroupPanel visible={true}
|
|
739
|
+
emptyPanelText="Use the context menu of header columns to group data"
|
|
740
|
+
/>
|
|
741
|
+
{/* <SearchPanel visible={true} highlightCaseSensitive={false} /> */}
|
|
742
|
+
|
|
743
|
+
<Grouping autoExpandAll={false} contextMenuEnabled={true} expandMode="rowClick"
|
|
744
|
+
/>
|
|
745
|
+
<FilterRow visible={true} />
|
|
746
|
+
<HeaderFilter visible={true} />
|
|
747
|
+
|
|
748
|
+
<Scrolling mode="virtual" useNative={false} />
|
|
749
|
+
<Summary>
|
|
750
|
+
<TotalItem column="sheetId" summaryType="count" displayFormat="Total: {0}" />
|
|
751
|
+
<GroupItem column="sheetId" summaryType="count" displayFormat="Count: {0}" />
|
|
752
|
+
</Summary>
|
|
753
|
+
|
|
754
|
+
</DataGrid>
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
{selectedRow && (
|
|
758
|
+
<Popup
|
|
759
|
+
visible={rowDetailsVisible}
|
|
760
|
+
onHiding={() => setRowDetailsVisible(false)}
|
|
761
|
+
showTitle
|
|
762
|
+
title={`Row Details`}
|
|
763
|
+
dragEnabled={false}
|
|
764
|
+
closeOnOutsideClick
|
|
765
|
+
showCloseButton
|
|
766
|
+
width={420}
|
|
767
|
+
height="100%"
|
|
768
|
+
position={{
|
|
769
|
+
my: "right top",
|
|
770
|
+
at: "right top",
|
|
771
|
+
of: window,
|
|
772
|
+
}}
|
|
773
|
+
wrapperAttr={{ class: "lookupscreenright-side-popup" }}
|
|
774
|
+
>
|
|
775
|
+
<div className="lookupscreenpopup-content">
|
|
776
|
+
{Object.entries(selectedRow).map(([key, value]) => (
|
|
777
|
+
<div className="form-group" key={key}>
|
|
778
|
+
<label>{formatLabel(key)}</label>
|
|
779
|
+
<input
|
|
780
|
+
type="text"
|
|
781
|
+
value={value ?? ""}
|
|
782
|
+
readOnly
|
|
783
|
+
/>
|
|
784
|
+
</div>
|
|
785
|
+
))}
|
|
786
|
+
</div>
|
|
787
|
+
</Popup>
|
|
788
|
+
)}
|
|
789
|
+
</div>
|
|
791
790
|
)}
|
|
792
|
-
</div>
|
|
793
|
-
)}
|
|
794
791
|
</div>
|
|
795
792
|
</div>
|
|
796
793
|
</div>
|