|  | @@ -15,6 +15,7 @@ class Search extends Component {
 | 
	
		
			
				|  |  |  		pembina: [],
 | 
	
		
			
				|  |  |  		selectedOptionMulti: [],
 | 
	
		
			
				|  |  |  		data: [],
 | 
	
		
			
				|  |  | +		nodata: false,
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	componentDidMount = async () => {
 | 
	
	
		
			
				|  | @@ -53,27 +54,44 @@ class Search extends Component {
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	fetchData = async () => {
 | 
	
		
			
				|  |  | -		const pembina = this.props.user.role.id === 2021 ? null : this.state.selectedOptionMulti.map((e) => e.value).join(",");
 | 
	
		
			
				|  |  | +		const pembina = this.props.user.role.id === 2021 ? null : this.state.selectedOptionMulti?.map((e) => e.value).join(",");
 | 
	
		
			
				|  |  |  		const searchValue = document.getElementById("searchInput").value;
 | 
	
		
			
				|  |  |  		const jsonData = await getPT(this.props.token, { search: searchValue, pembina });
 | 
	
		
			
				|  |  |  		this.setState({ data: jsonData.data ? jsonData.data : [] });
 | 
	
		
			
				|  |  | +		// console.log(this.state.data)
 | 
	
		
			
				|  |  |  	};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	handleApplyClick = () => {
 | 
	
		
			
				|  |  | -		this.fetchData();
 | 
	
		
			
				|  |  | -		if (this.state.data && this.state.data.length) {
 | 
	
		
			
				|  |  | -			this.renderTableData();
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -	};
 | 
	
		
			
				|  |  | +	// handleApplyClick = () => {
 | 
	
		
			
				|  |  | +	// 	this.fetchData();
 | 
	
		
			
				|  |  | +	// 	if (this.state.data && this.state.data.length > 0) {
 | 
	
		
			
				|  |  | +	// 		this.renderTableData();
 | 
	
		
			
				|  |  | +	// 		this.setState({ noData: true });
 | 
	
		
			
				|  |  | +	// 		// this.setState({ noData: false });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 	}
 | 
	
		
			
				|  |  | +	// 	this.checknodata();
 | 
	
		
			
				|  |  | +	// 	// else {
 | 
	
		
			
				|  |  | +	// 	// 	this.setState({ noData: true })
 | 
	
		
			
				|  |  | +	// 	// }
 | 
	
		
			
				|  |  | +	// };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// handleSearchClick = () => {
 | 
	
		
			
				|  |  | +	// 	this.fetchData();
 | 
	
		
			
				|  |  | +	// 	if (this.state.data && this.state.data.length) {
 | 
	
		
			
				|  |  | +	// 		this.renderTableData();
 | 
	
		
			
				|  |  | +	// 		this.setState({ noData: true });
 | 
	
		
			
				|  |  | +	// 		// this.setState({ noData: false });
 | 
	
		
			
				|  |  | +	// 	}
 | 
	
		
			
				|  |  | +	// 	else {
 | 
	
		
			
				|  |  | +	// 		// this.setState({ noData: true });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 		this.checknodata();
 | 
	
		
			
				|  |  | +	// 	}
 | 
	
		
			
				|  |  | +	// };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	handleSearchClick = () => {
 | 
	
		
			
				|  |  | -		this.fetchData();
 | 
	
		
			
				|  |  | -		if (this.state.data && this.state.data.length) {
 | 
	
		
			
				|  |  | -			this.renderTableData();
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -	};
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	renderTableData() {
 | 
	
		
			
				|  |  | +		console.log(this.state.data)
 | 
	
		
			
				|  |  |  		return (
 | 
	
		
			
				|  |  |  			this.state.data &&
 | 
	
		
			
				|  |  |  			this.state.data.map((pt, index) => {
 | 
	
	
		
			
				|  | @@ -112,6 +130,22 @@ class Search extends Component {
 | 
	
		
			
				|  |  |  		);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +	handleApplyClick = () => {
 | 
	
		
			
				|  |  | +		this.fetchData();
 | 
	
		
			
				|  |  | +		if (this.state.data && this.state.data.length > 0) {
 | 
	
		
			
				|  |  | +			this.renderTableData();
 | 
	
		
			
				|  |  | +			this.setState({ noData: true });
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	handleSearchClick = () => {
 | 
	
		
			
				|  |  | +		this.fetchData();
 | 
	
		
			
				|  |  | +		if (this.state.data && this.state.data.length) {
 | 
	
		
			
				|  |  | +			this.renderTableData();
 | 
	
		
			
				|  |  | +			this.setState({ noData: true });
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	render() {
 | 
	
		
			
				|  |  |  		const { selectedOptionMulti, pembina } = this.state;
 | 
	
		
			
				|  |  |  		return (
 | 
	
	
		
			
				|  | @@ -133,6 +167,7 @@ class Search extends Component {
 | 
	
		
			
				|  |  |  								onKeyPress={(e) => {
 | 
	
		
			
				|  |  |  									if (e.key === "Enter") {
 | 
	
		
			
				|  |  |  										this.handleApplyClick();
 | 
	
		
			
				|  |  | +										this.handleSearchClick();
 | 
	
		
			
				|  |  |  									}
 | 
	
		
			
				|  |  |  								}}
 | 
	
		
			
				|  |  |  							/>
 | 
	
	
		
			
				|  | @@ -158,7 +193,7 @@ class Search extends Component {
 | 
	
		
			
				|  |  |  							</Table>
 | 
	
		
			
				|  |  |  							{/* END table-responsive */}
 | 
	
		
			
				|  |  |  							<div className="card-footer">
 | 
	
		
			
				|  |  | -								<div className="d-flex"></div>
 | 
	
		
			
				|  |  | +								<div >{!this.state.data.length > 0 && this.state.noData && (<h3 className=" text-center">Data tidak ditemukan</h3>)}</div>
 | 
	
		
			
				|  |  |  							</div>
 | 
	
		
			
				|  |  |  						</div>
 | 
	
		
			
				|  |  |  						{/* END card */}
 |