JezK
Edit File: index copy 1.php
<?php ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); require_once('../wp-load.php'); require('../wp-blog-header.php'); get_header(); //Include header ?> <?php $today = date('Y-m-d'); $login_url = 'https://www.iru-miru.com/en/login.php'; $base_url = 'https://www.iru-miru.com/en/metal_detail.php'; $types = [ 2 => 'Rare earth', 18 => 'Battery', 7 => 'Minor metal', 8 => 'Precious metal / PGM', 1 => 'Lead / Zinc / Tin', 3 => 'Aluminum', 6 => 'Copper', 9 => 'Iron ore / steel', 5 => 'SUS / Ferroalloy', 4 => 'E-waste', 15 => 'SCD / Electronics', 16 => 'Recycling' ]; $metals = [ 1 => [ 1 => 'LME Lead ($/MT)', 2 => 'Lead price (JPY/kg)', 3 => 'Lead battery scrap (JPY/kg)', 4 => 'Lead pipe (JPY/kg)', 171 => 'Lead ore (TC50%) ($/MT)', 5 => 'LME Zinc ($/MT)', 6 => 'Yamamoto price (JPY/kg)', 172 => 'Zinc ore (TC50%) ($/MT)', 7 => 'LME Tin ($/MT)', 8 => 'Domestic Tin Bullion (JPY/kg)' ], 2 => [ 9 => 'Cerium metal (99%min in China) (RMB/kg)', 10 => 'Cerium metal (99%FOB China) ($/kg)', 11 => 'Cerium oxide (99%min in China) (RMB/kg)', 12 => 'Cerium oxide (99% FOBChina) ($/kg)', 219 => 'Cerium carbonate (45-50% CeO2/TREO 100% FOBChina) ($/MT)', 13 => 'Dysprosium metal (99%min in China) (RMB/kg)', 14 => 'Dysprosium metal (99% FOBChina) ($/kg)', 15 => 'Dysprosium oxide (99%min in China) (RMB/kg)', 16 => 'Dysprosium oxide (99%FOB China) ($/kg)', 17 => 'Europium oxide (99%min in China) (RMB/kg)', 18 => 'Europium oxide (99% FOBChina) ($/kg)', 19 => 'Dysprosium iron alloy (99%min Dy 80% in China) (RMB/kg)', 20 => 'Dysprosium iron alloy (99%min Dy 80% FOBChina) ($/kg)', 220 => 'Erbium oxide (99%min FOBChina) ($/kg)', 23 => 'Gadolinium oxide (99%min in China) (RMB/kg)', 24 => 'Gadolinium oxide (99.99%min in China) ($/kg)', 25 => 'Lanthanum metal (99%min in China) (RMB/kg)', 26 => 'Lanthanum metal (99% FOBChina) ($/kg)', 27 => 'Lanthanum oxide (99%min in China) (RMB/kg)', 28 => 'Lanthanum oxide (99% FOBChina) ($/kg)', 29 => 'Lanthanum oxide (99.999%min in China) (RMB/kg)', 30 => 'Lanthanum oxide (99.999% FOBChina) ($/kg)', 32 => 'Misch metal (TREM≥99% Ce/TREM≥65% China) (RMB/kg)', 33 => 'Misch metal (TREM≥99% Ce/TREM≥65% China) ($/kg)', 34 => 'Misch metal (PrNd 99%min Nd 75% China) (RMB/kg)', 35 => 'Misch metal (PrNd 99%min Nd 75% FOBChina) ($/kg)', 36 => 'Neodymium metal (99%min in China) (RMB/kg)', 37 => 'Neodymium metal (99% FOBChina) ($/kg)', 38 => 'Neodymium oxide (99% in China) (RMB/kg)', 39 => 'Neodymium oxide (99% FOBChina) ($/kg)', 221 => 'Praseodymium oxide (99% FOBChina) ($/MT)', 40 => 'Praseodymium metal (99% FOBChina) ($/kg)', 41 => 'Terbium oxide (99.9%min in China) (RMB/kg)', 42 => 'Terbium oxide (99.9% FOBChina) ($/kg)', 43 => 'Yttrium oxide (99.999%min in China) (RMB/kg)', 44 => 'Yttrium oxide (99.999% FOBChina) ($/kg)', 45 => 'Samarium oxide (99.9%min in China) (RMB/kg)', 46 => 'Samarium oxide (99%min FOBChina) ($/kg)', 47 => 'Samarium metal (99%min in China) (RMB/kg)', 48 => 'Samarium metal (99%min FOBChina) ($/kg)', 236 => 'Scandium oxide (99.99%min China) (RMB/kg)' ], 3 => [ 49 => 'LME Aluminium ($/MT)', 50 => 'LME Aluminium Alloy ($/MT)', 169 => 'Australia alumina (FOB Australia USD/ton) (US$/ton)', 234 => 'Brazil alumina (FOB Brazil USD/ton) (US$/ton)', 249 => 'Aluminium P1020A premium, in-whs dp Rotterdam ($/tonne)', 250 => 'Aluminium P1020A premium, ddp Midwest US (cents/lb)', 251 => 'Aluminium P1020A (MJP) spot premium, cif Japan ($/ton)', 51 => 'NSP (Domestic aluminum metal) (JPY/kg)', 52 => 'Japan ADC12 (JPY/kg)', 53 => 'Sigma D12S ($/t)', 54 => 'Russia AK5M2 ($/t)', 55 => 'China ADC12(CIF Japan) (USD/ton)', 237 => 'Zorba (Metal97-98%CIF China) (USD/ton)', 56 => 'Aluminum 2S new cut (JPY/kg)', 57 => 'Aluminum sash 63 (No screw) (JPY/kg)', 58 => 'Aluminum 52 new cut (JPY/kg)', 59 => 'Aluminum Sash with screw (Pressed goods) (JPY/kg)', 60 => 'Aluminum wheel Mix (JPY/kg)', 61 => 'Japan aluminum base metal (JPY/kg)', 62 => 'Aluminum printing board (JPY/kg)', 63 => 'Aluminum new machine casting (JPY/kg)', 64 => 'Aluminum UBC(usedbeverage can) (JPY/kg)', 65 => 'Alum Dalai powder MIX (JPY/kg)', 66 => 'Aluminum-containing glass (JPY/kg)', 67 => 'Air conditioner radiator (with copper tube) (JPY/kg)', 71 => 'Black and white engine (JPY/kg)', 72 => 'White engine (JPY/kg)' ], 4 => [ 73 => 'Ceramic CPU (pure) (JPY/kg)', 74 => 'HDD board (JPY/kg)', 75 => 'IC board (middle) (JPY/kg)', 76 => 'Motherboard (MIX) (JPY/kg)', 77 => 'Motherboard (upper) * PEN III or earlier (JPY/kg)', 78 => 'Motherboard (bottom) * PENIV or later (JPY/kg)', 79 => 'Laptop motherboard (JPY/kg)', 80 => 'Memory board (JPY/kg)', 81 => 'Lithium ion battery (JPY/kg)', 261 => 'Lithium ion battery (JPY/kg)', 82 => 'Home appliance board (except washing machine) (JPY/kg)', 83 => 'Mobile phone (main body) (JPY/kg)' ], 5 => [ 84 => 'LME Nickel ($/MT)', 85 => 'Domestic nickel metal (JPY/kg)', 245 => 'NPI content 10-15% China (RMB/NickelMTU)', 244 => 'Nickel Ore Philippine 1.8%min CIF China ( USD/mt)', 86 => 'High carbon ferrochrome ($/LB)', 87 => 'Low carbon ferrochrome ($/LB)', 248 => 'Chrome ore South Africa UG2 concentrates Cr42%, CIF/China ($/ton)', 88 => 'High carbon ferromanganese(Mn75%min, C8%Max Europe) (EUR/MT)', 90 => 'Ferromanganese flakes(Mn99.7% Ex-VAT FOB China) ($/MT)', 91 => 'Silicomanganese (Mn65/Si17China) ($/MT)', 235 => 'Calcium silicon(30-55FOBChina) (USD/ton)', 92 => 'Ferrosilicon (72%minSiFOB China) ($/MT)', 93 => 'Molybdenum oxide ($/LB)', 94 => 'Ferromolybdenum (basisMo65% min) ($/kg Mo)', 95 => 'Ferroniobium ($/kg Nb)', 96 => 'Ferrotitanium ($/kg Ti)', 97 => 'Ferrotungsten ($/kg)', 98 => 'Ferrovanadium (basis 78% min EU, freemarketdelivered duty paidtoconsumer plant) ($/kg)', 99 => 'Niobium pentoxide ($/kg)', 100 => 'Vanadium pentoxide(V2O5) ($/lb V2O5 FOB CHINA)', 101 => 'Australian Manganese ore (Mn44%min US $/Mn1%) (USD/MTU)', 102 => '304 series scrap (JPY/kg)', 103 => '316 series scrap (JPY/kg)', 104 => '430 series scrap (JPY/kg)', 105 => '310 series scrap (JPY/kg)', 106 => '304 series scrap (JPY/kg)', 107 => '42 alloy scrap (JPY/kg)', 108 => 'MIX SKH50-59 (JPY/kg)', 109 => 'SKH50-59 (JPY/kg)', 110 => 'Pure titanium sheet scrap (JPY/kg)', 111 => 'Titanium alloy scrap (JPY/kg)', 112 => 'Titanium carbidescrap (JPY/kg)', 252 => 'hastelloyX (JPY/kg)', 253 => 'hastelloy C (JPY/kg)', 254 => 'inconell718 (JPY/kg)', 255 => 'inconell625 (JPY/kg)', 256 => 'incolloy800 (JPY/kg)', 257 => '6-4titanium ultra (JPY/kg)', 258 => 'molybdenum solid scrap (JPY/kg)', 259 => 'tantalum PIN scrap (JPY/kg)', 260 => 'ND magnet scrap (JPY/kg)', 113 => '304 cold rolled stainless sheet 2mm thickness (JPY/kg)', 114 => '430 cold rolled stainless sheet (JPY/kg)', 115 => '316 hot rolled stainless sheet 7mm thickness (JPY/kg)', 116 => '304 steel stainless bar (JPY/kg)', 243 => 'Stainless steel cold-rolled coil EastAsia CIF 304 (2mm 2B) ($/ton)', 269 => 'China Stainless Scrap (304 Solid in China) (RMB/mt)' ], 6 => [ 117 => 'LMECopper ($/MT)', 118 => 'NY Copper ($/lb)', 119 => 'SHFE Copper ($/MT(incTax))', 120 => 'Copper price (JPY/kg)', 121 => 'Number one picker linebare bright (JPY/kg)', 122 => 'Fresh copper cut (JPY/kg)', 123 => 'Copper (for smelting and refining Cu95%) (JPY/kg)', 124 => 'Coated copper wire (Cu40%) (JPY/kg)', 125 => 'Brass (JPY/kg)', 126 => 'Brass powder (JPY/kg)', 262 => 'night (円/kg)', 263 => 'Brass powder (円/kg)', 264 => 'Brass powder (円/kg)', 265 => 'Brass powder (円/kg)', 127 => 'Copper brass A (without impurities) (JPY/kg)', 128 => 'Phosphor bronze (JPY/kg)', 129 => 'Gunmetal roller (parallel bronze casting/without accessories) (JPY/kg)', 130 => 'Harness (JPY/kg)', 170 => 'Copper ore (TC30%) ($/MT)' ], 7 => [ 132 => 'Antimony (99.65% China) ($/MT)', 133 => 'Antimony trioxide (99.5%min FOBChina) ($/MT)', 134 => 'Bismuth (EU Freemarket) ($/LB)', 135 => 'Bismuth oxide (99.9%min in China) ($/kg)', 238 => 'LME Cobalt (US$/ton)', 136 => 'LG Cobalt (Co 99.3%) ($/LB)', 266 => 'HG Cobalt (Co 99.8%) ($/lb)', 138 => 'Cadmium (99.95% EU) ($/LB)', 222 => 'Ferrochrome (EU Freemarket) ($/MT)', 139 => 'Gallium (EU Freemarket) ($/kg)', 140 => 'Germanium metal (99.99% China) ($/kg)', 141 => 'Germanium oxide (99.999% China) ($/kg)', 142 => 'Indium (99.99% China) ($/kg)', 223 => 'Lithium metal (99.9% Delivered China) (RMB/mt)', 143 => 'Lithium carbonate (99% China) (RMB/mt)', 239 => 'Lithium carbonate (99.5% China) (RMB/mt)', 224 => 'Lithium hydroxide (56.5%min Delivered China) (RMB/mt)', 144 => 'Magnesium (99.9%China) (USD/MT)', 145 => 'Selenium (99.9%) (USD/lb)', 146 => 'Tellurium (99.95%) (USD/kg)', 150 => 'Rhenium (99.9% US) ($/kg)', 151 => 'Ferrosilicon (553 China) ($/MT)', 152 => 'Ferrosilicon (441 China) ($/MT)', 153 => '6N silicon (Solar-grade China) ($/kg)', 155 => 'Tantalite (Ta2O5 30%min CIFChina) ($/LB Ta2O5)', 156 => 'Tantalum (99.95% China) ($/kg)', 157 => 'Tantalum pentoxide ($/kg)', 158 => 'Titanium ore (Ilmenite) TI02 50% Fe203 14% ($/t)', 159 => 'Rutile sand (TIO290% China) ($/MT)', 160 => 'Titanium oxide (Rutile TiO2 93%min FOBChina) (USD/ton)', 161 => 'Titanium sponge ($/kg)', 162 => 'Tungsten ore (WO350%) (USD/mtu)', 163 => 'APT (EU Freemarket) ($/MTU)', 164 => 'Tungsten carbide (99.7%min 2.5-7.0micron FOBChina) ($/kg)', 165 => 'Tungsten oxide (WO3 99.95%min FOBChina) ($/mtu)', 166 => 'Tungsten bar (W-4 99.9% China) ($/kg)', 167 => 'Zirconium sponge (99.4%Zr+Hf) China (RMB/kg)', 168 => 'Zircon sand (ZrO266% CIF China) ($/MT)', 225 => 'Zirconium oxychloride (Zr(Hf)O2 36%min EXW China) (RMB/mt)' ], 8 => [ 173 => 'Gold (Yamamoto price) (JPY/g)', 174 => 'Silver (Yamamoto price) (JPY/kg)', 175 => 'Japan platinum (JPY/g)', 176 => 'Japan palladium (JPY/g)', 177 => 'NY Gold ($/toz)', 178 => 'NY Silver ($/toz)', 179 => 'NY Palladium ($/toz)', 180 => 'NY Platinum ($/toz)', 181 => 'Rhodium Johnson Matthey ($/toz)', 182 => 'Iridium ($/toz)', 183 => 'Ruthenium ($/toz)', 184 => 'Japan rhodium (JPY/g)', 185 => 'Japan iridium (JPY/g)', 186 => 'Japan ruthenium (JPY/g)', 187 => 'Automobile waste catalyst (honeycomb) Large (JPY/unit)', 188 => 'Automobile waste catalyst (honeycomb) Medium (JPY/unit)', 189 => 'Automobile waste catalyst (honeycomb) Small (JPY/unit)' ], 9 => [ 190 => 'Iron ore (62%Fe USD/ton CFRChina Qindao) ($/Dryton)', 191 => 'Small stick (JPY/mt)', 192 => 'H steel (JPY/mt)', 226 => 'US Composite ($/ton)', 193 => 'H2 (3 area average price:Kanto, Nagoya, Osaka) (JPY/mt)', 194 => 'H2 (special grade, domestic price) (JPY/t)', 231 => 'H2 (Totetsu-Okayama Sea) (JPY/t)', 232 => 'H2 (Totetsu Tahara Onsen) (JPY/t)', 233 => 'Raw material coal (High-grade strong sticky coal AUFOB USD/ton) (US$/ton)', 195 => 'New shredded steel scrap (JPY/t)', 196 => 'High manganese steel (JPY/t)', 197 => 'C press (JPY/t)', 227 => 'Graphite electrode (RMB/mt)', 246 => 'Steel scrap HMS 1&2 (75:25 mix) import,cfr delivered Turkish port ($/ton)', 247 => 'Steel scrap HMS 1&2 (80:20), cfr Vietnam, ($/ton)', 268 => 'China Steel Scrap (HMS in China) (RMB/mt)', 267 => 'China Steel Billt (RMB/mt)' ], 15 => [ 154 => '11N silicon (semiconductor US) ($/kg)' ], 16 => [ 198 => 'Industrial miscellaneous goods (JPY/kg)' ], 18 => [ 240 => 'Nickel Sulfate (RMB/mt)', 241 => 'Cobalt Sulfate (RMB/mt)', 242 => 'NCM 523 Delivered China (RMB/ton)' ] ]; $login_data = [ 'mode' => 'login', 'login_id' => 'nabeel.mancheri@global-reia.org', 'login_pw' => 'reia2586' ]; $result = wp_remote_post("https://www.iru-miru.com/en/login.php", [ 'method' => 'POST', 'user-agent' => 'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.76 Mobile Safari/537.36', 'body' => $login_data ]); $cookies = $result["cookies"]; function fetch_metals($base_url,$cookies, $gid) { $response = wp_remote_get('https://www.iru-miru.com/en/metal_detail.php?id=11&type=4#_ABSTRACT_RENDERER_ID_1', [ 'method' => 'GET', 'user-agent' => 'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.76 Mobile Safari/537.36', 'cookies' => $cookies ]); $content = wp_remote_retrieve_body($response); $dom = new DOMDocument('1.0', 'UTF-8'); @$dom->loadHTML('<?xml encoding="utf-8" ?>' . $content); $node = @$dom->getElementById('categoryId'); $items = []; if ($node) { foreach ($node->childNodes as $option) { if ($option->nodeName !== 'option' || empty($option->nodeValue)) { continue; } $items[@$option->getAttribute('value')] = trim($option->textContent); } } return $items; } function parse_data($content, $date) { $matches; preg_match('/\[\'' . $date . '\',.{2,20}?]/', $content, $matches); if(!empty($matches)){ return $matches[0]; }else{ return "No Data"; } } function get_data($type, $date) { global $wpdb; $yesterday = date('Y-m-d',(strtotime ( '-1 day' , strtotime ( $date) ) )); $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM reia_market_prices WHERE type = %d AND date = '%s'", $type, $date)); //print_r($results); if(count($results)) { return $results; } else { return $this->get_data($type, $yesterday); } } function insert_data($type, $description, $prices) { global $wpdb; foreach ($prices as $row) { $wpdb->insert("reia_market_prices", [ 'type' => $type, 'description' => $description, 'date' => $row[0], 'price' => $row[1], 'price_min' => (!empty($row[2]) ? $row[2] : null), 'price_max' => (!empty($row[3]) ? $row[3] : null) ], [ '%d', '%s', '%s', '%f', '%f', '%f' ]); } } ?> <script type="text/javascript" src="https://canvasjs.com/assets/script/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="https://cdn.canvasjs.com/canvasjs.stock.min.js"></script> <script type="text/javascript" src="https://cdn.canvasjs.com/canvasjs.min.js"></script> <script src="https://code.jquery.com/jquery-3.5.1.js"></script> <script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <!-- <script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.stock.min.js"></script> --> <script> $(document).ready(function() { var datapoints = []; var ore; var duration; console.log(ore) $(".tablinks").click(function() { ore = $(this).val() ? $(this).val() : "Rare_Earth" var matrialTypeToGetEle = document.getElementById('typeOfMaterialNumber').value $.ajax({ method: 'POST', url: "alloyslist.php", data: { ore: matrialTypeToGetEle }, success: function(response) { $("#metals").empty(); var optionsRes = JSON.parse(response) optionsRes.forEach(element => { $("#metals").append(`<option value="${element.description}">${element.description}</option>`); }); $(".months").first().trigger('click'); $("#metals").first().trigger('change'); } }) }) $(".months").click(function() { duration = $(this).val() ? $(this).val() : "1"; $("#metals").first().trigger('change'); }) var options = { axisX: { valueFormatString: "YYYY/MM/DD" // set date format string here }, title: { text: '' }, data: [{ type: "line", dataPoints: [] }] }; // create chart object instance var chart = new CanvasJS.Chart("stockChartContainer", options); // function to update chart data function updateChartData(datapoints, selectedAlloy) { options.title.text = selectedAlloy; for (i in datapoints) { options.data[0].dataPoints.push(datapoints[i]); } chart.render(); console.log(options,'options') } $("#metals").change(function() { let selectedAlloy = $(this).val(); let dateSelctedFrom = document.getElementById('calender').value; console.log(ore, duration, selectedAlloy) $.ajax({ method: 'POST', url: "alloysprice.php", data: { ore: ore ? ore : "Rare_Earth", duration: duration, selectedAlloy: selectedAlloy, dateSelectedFromCalender:dateSelctedFrom }, success: function(response) { options.data[0].dataPoints = [] const parserChartRes = JSON.parse(response) // Removing the "x" key from each object using map() var newParserChartRes = parserChartRes.map(function(obj) { var newObj = { ...obj }; // Create a shallow copy of the object newObj.y = parseInt(newObj.y); // Change the "y" value to an integer delete newObj.x; // Delete the "x" key from the copied object return newObj; // Return the modified object }); console.log(newParserChartRes); updateChartData(newParserChartRes, selectedAlloy); }, error: function(xhr, status, error) { console.log(xhr,status, error); } }) }); $(".tablinks").first().trigger('click'); $("#calender").change(function(e) { console.log(ore) var materialTypeSelected = document.getElementById('typeOfMaterialNumber').value getDataFromDataBase(e.target.value,materialTypeSelected,ore) }) }); function openCity(evt, cityName,material_type) { $('#typeOfMaterialNumber').val(material_type) //memory the value of material or tab for other changes let dateSendToAjax = document.getElementById('calender').value; //'<?php echo $today; ?>' var i, tabcontent, tablinks; tabcontent = document.getElementsByClassName("tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getElementsByClassName("tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } document.getElementById(cityName).style.display = "block"; evt.currentTarget.className += " active"; getDataFromDataBase(dateSendToAjax,material_type,evt.target.value) } function getDataFromDataBase(reqDate,reqMaterialType,reqDataTableName){ $.ajax({ url: 'https://bu3is.krify.com/REIA_Web/marketDataNew/getMarketData.php', type: 'POST', data: { material_type:reqMaterialType,date: reqDate }, // dataType: 'json', success: function(response) { // Process the returned data const parsedData = JSON.parse(response); // Extract desired columns from the data var extractedData = parsedData.map(function(row) { return [row.description, row.price, row.price_min,row.price_max]; }); // Get the DataTable instance var table = $(`#${reqDataTableName}_Table`).DataTable(); // Clear existing rows and destroy the DataTable instance table.clear().destroy(); // Add new rows to the DataTable extractedData.forEach(function(rowData) { table.row.add(rowData); }); // Recreate the DataTable with the updated data and options table = $(`#${reqDataTableName}_Table`).DataTable({ data: extractedData, destroy: true, // Destroy the previous instance paging: true, // Enable pagination // Add any other DataTable options as needed }); }, error: function(xhr, status, error) { console.log(xhr,status, error); } }); } </script> <style> body { max-width:100% !important } a { text-decoration: none; } .site-content .ast-container { display: block; } .dataTables_filter { margin-bottom: 1rem; } .dataTables_paginate.paging_full_numbers { font-size: 14px; margin-top: 1rem; } .dataTables_info { font-size: 14px; margin-top: 1rem; } /* Style the tab */ .tab { float: left; border: 1px solid #ccc; background-color: #f1f1f1; width: 25%; margin-bottom: 2rem; } /* Style the buttons inside the tab */ .tab button { display: block; background-color: inherit; color: black; padding: 21px 16px; width: 100%; border: none; outline: none; text-align: left; cursor: pointer; transition: 0.3s; font-size: 16px; } /* Change background color of buttons on hover */ .tab button:hover { background-color: #ddd; } /* Create an active/current "tab button" class */ .tab button.active { background-color: #20bec7; color: white; font-weight: 600; } /* Style the tab content */ .tabcontent { float: left; padding: 0px 12px; border: 1px solid #ccc; width: 75%; padding: 1rem; } .market_img { display: block; margin: auto; width: 60%; } div#example_filter { margin-bottom: 1rem; } .main p { padding: 1rem 0; } .main img { padding: 1rem 0; } .main h5 { padding: 1rem 0; margin-bottom: 0; } .dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover { background: linear-gradient(to bottom, rgb(0 191 199 / 8%) 0%, rgb(0 191 199 / 40%) 100%); border-radius: 50px; } .dataTables_wrapper .dataTables_paginate .paginate_button { padding: 0.2em 0.8em; } .header { padding: 3rem; background: #323232; } .btn-group button { background-color: #04AA6D; /* Green background */ border: 1px solid green; /* Green border */ color: white; /* White text */ padding: 2px 10px; /* Some padding */ cursor: pointer; /* Pointer/hand icon */ float: left; /* Float the buttons side by side */ height: 40px; } .header p { color: white; } tr.odd { background: #00bfc714 !important; } .table_top{ display: flex; justify-content: space-between; background:#00bfc72e; padding: 1rem; border-radius: 5px } body{ max-width: 100% !important; } @media (max-width: 767px){ .table_top{ display: block; } .tablinks { padding: 8px !important; font-size: 14px !important; } } </style> <div class="header"> <h2 style="color: white">Market Data</h2> <p>Best Practice for Sustainable Rare Earth Supply</p> </div> <div class="main"> <p> The database provides daily price updates of rare earth products, minor metals, battery materials, precious metals and base metals. </p> <h5 style="font-weight:600"> Access to the database is only provided to REIA members. If you like to know more, please <a href="https://bu3is.krify.com/REIA_Web/contact-us/"><span style="color:#20bec7">contact us.</span></a> </h5> <img src="https://bu3is.krify.com/REIA_Web/wp-content/uploads/2023/04/marketdata.png" class="market_img"> </div> <div class="table_top"> <div><label>Listing Date</label><input type="date" id="calender" class="form-control" value="<?php echo $today; ?>"></div> <div class="btn-group d-block"> <p style="margin-bottom: 0.5rem">Range</p> <button class="months" value="1">1m</button> <button class="months" value="3">3m</button> <button class="months" value="6">6m</button> <button class="months" value="9">9m</button> <button class="months" value="12">12m</button> <!-- <button class="months" value="all">All</button> --> </div> <div> <label>Chart for Commodity</label> <select id="metals" class="form-control"> <option value="0">Select Alloy:</option> </select> </div> </div> <div id="stockChartContainer" style="height: 400px; width: 100%;"></div> <div style="margin-bottom:1rem; margin-top: 1rem"> <input type='hidden' id='typeOfMaterialNumber'/> <div class="tab"> <button class="tablinks" onclick="openCity(event, 'Rare Earth',2)" id="defaultOpen" value="Rare_Earth">Rare Earth</button> <button class="tablinks" onclick="openCity(event, 'Battery',18)" value="Battery">Battery</button> <button class="tablinks" onclick="openCity(event, 'Minor metal',7)" value="minor_metal">Minor metal</button> <button class="tablinks" onclick="openCity(event, 'Precious metal',8)" value="Precious_metal_PGM">Precious metal / PGM</button> <button class="tablinks" onclick="openCity(event, 'Lead',1)" value="Lead_Zinc_Tin">Lead / Zinc / Tin</button> <button class="tablinks" onclick="openCity(event, 'Aluminium',3)" value="Aluminium">Aluminium</button> <button class="tablinks" onclick="openCity(event, 'Copper',6)" value="Copper">Copper</button> <button class="tablinks" onclick="openCity(event, 'Iron',9)" value="Iron_ore_steel">Iron ore / steel</button> <button class="tablinks" onclick="openCity(event, 'SUS',5)" value="SUS_Ferroalloy">SUS / Ferroalloy</button> <button class="tablinks" onclick="openCity(event, 'E-waste',4)" value="E-waste">E-waste</button> <button class="tablinks" onclick="openCity(event, 'SCD',15)" value="SCD_Electronics">SCD / Electronics</button> <button class="tablinks" onclick="openCity(event, 'Recycling',16)" value="Recycling">Recycling</button> </div> <div id="Rare Earth" class="tabcontent"> <table class="example table-responsive" id='Rare_Earth_Table' class="display" style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> <th>Min Price</th> <th>Max Price</th> </tr> </thead> <tbody> </tbody> </table> </div> <div id="Battery" class="tabcontent"> <table class="example" class="display" id='Battery_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['Battery'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="Minor metal" class="tabcontent"> <table class="example" class="display" id='minor_metal_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['Minor metal'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="Precious metal" class="tabcontent"> <table class="example" class="display" id='Precious_metal_PGM_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['Precious metal / PGM'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="Lead" class="tabcontent"> <table class="example" class="display" id='Lead_Zinc_Tin_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['Lead / Zinc / Tin'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="Aluminium" class="tabcontent"> <table class="example" class="display" id='Aluminium_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['Aluminum'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="Copper" class="tabcontent"> <table class="example" class="display" id='Copper_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['Copper'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="Iron" class="tabcontent"> <table class="example" class="display" id='Iron_ore_steel_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['Iron'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="SUS" class="tabcontent"> <table class="example" class="display" id='SUS_Ferroalloy_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['SUS, Ferrous Alloy'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="E-waste" class="tabcontent"> <table class="example" class="display" id='E-waste_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['E-Waste'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="SCD" class="tabcontent"> <table class="example" class="display" id='SCD_Electronics_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['SCD / Electronic materials'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> <div id="Recycling" class="tabcontent"> <table class="example" class="display" id='Recycling_Table' style="width:100%"> <thead> <tr> <th>Commodity Description</th> <th>Price</th> </tr> </thead> <tbody> <?php foreach ($finalData['Recycling'] as $alloy => $price) { // print_r($price); echo "<tr> <td>" . $alloy . "</td><td>" . $price . "</td></tr>"; } ?> </tbody> </table> </div> </div> <script> // Get the element with id="defaultOpen" and click on it document.getElementById("defaultOpen").click(); $(document).ready(function() { $('.example').DataTable({ pagingType: 'full_numbers', }); }); </script> <?php get_footer(); //Include footer ?>