Skip to content
Snippets Groups Projects
Commit 3ec8cff7 authored by Ulung32's avatar Ulung32
Browse files

add getTrackDetail (call from soap)

parent 6b714162
No related merge requests found
<?php
function pesanan_card_template($namaPesanan, $harga, $status, $idPesanan) {
$href = "href='/trackDetail/$idPesanan'";
$redirectText = "Detail Pesanan";
$html = <<<"EOT"
<article>
<a $href>
<div class="article-preview">
<h2>$namaPesanan</h2>
<h4>$harga</h4>
<p>$status</p>
<h1>$redirectText</h1>
</div>
</a>
</article>
EOT;
echo $html;
}
\ No newline at end of file
...@@ -20,20 +20,35 @@ ...@@ -20,20 +20,35 @@
<span class="centering"> <span class="centering">
<ul> <ul>
<?php <?php
include_once(dirname(__DIR__) . "/template/HistoryCard.php"); include_once(dirname(__DIR__) . "/template/PesananCard.php");
?> ?>
<section class="articles"> <section class="articles">
<?php <?php
$index = 1; $index = 1;
foreach ($this->data['pesanan'] as $pesanan) {
history_card_template(
"Pesanan".$index, // var_dump(count($this->data['pesanan']));
$pesanan['price'], if(is_array($this->data['pesanan']->return)){
$pesanan['status'], foreach ($this->data['pesanan']->return as $pesanan) {
$pesanan['id']); pesanan_card_template(
$index++; "Pesanan".$index,
$pesanan->harga,
$pesanan->status,
$pesanan->id);
$index++;
}
}else{
foreach ($this->data['pesanan'] as $pesanan) {
pesanan_card_template(
"Pesanan".$index,
$pesanan->harga,
$pesanan->status,
$pesanan->id);
$index++;
}
} }
?> ?>
</section> </section>
</ul> </ul>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Track detail</title>
<link rel="stylesheet" href="../../styles/Global.css">
<link rel="stylesheet" href="../../styles/history/HistoryDetail.css">
</head>
<body>
<?php
include(dirname(__DIR__) . '/template/Navbar.php');
?>
<div>
<h1>Detail Pesanan</h1>
<div class="container">
<label>Nama Kurir : </label>
<p><?=$this->data['pesanan']->return->alamat?></p>
<label>Biaya ongkir : </label>
<p><?=$this->data['pesanan']->return->biaya_pengiriman?></p>
<label>Status : </label>
<p><?=$this->data['pesanan']->return->status?></p>
<label>Keterangan : </label>
<p><?=$this->data['pesanan']->return->keterangan?></p>
<label>Biaya ongkir : </label>
<p><?=$this->data['pesanan']->return->biaya_pengiriman?></p>
<label>Alamat : </label>
<p><?=$this->data['pesanan']->return->alamat?></p>
<h3>Pesanan Details</h3>
<table>
<tr>
<th>Product Name</th>
<th>Quantity</th>
</tr>
<?php
$temp = "";
if(is_array($this->data['detailpesanan']->return)){
foreach ($this->data['detailpesanan']->return as $product) {
$namaproduk = $product->nama_product;
$quantity = $product->quantity;
$temp .="
<tr>
<td>$namaproduk</td>
<td>$quantity</td>
</tr>
";
}
}else{
// var_dump($this->data['detailpesanan']);
$namaproduk = $this->data['detailpesanan']->return->nama_product;
$quantity = $this->data['detailpesanan']->return->quantity;
$temp .="
<tr>
<td>$namaproduk</td>
<td>$quantity</td>
</tr>
";
}
echo $temp;
?>
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
...@@ -7,6 +7,7 @@ class TrackController extends Controller{ ...@@ -7,6 +7,7 @@ class TrackController extends Controller{
$userId = $_SESSION['user_id']; $userId = $_SESSION['user_id'];
PesananSoap::setSoapClient("pesanan"); PesananSoap::setSoapClient("pesanan");
$result = PesananSoap::getPesanan($userId); $result = PesananSoap::getPesanan($userId);
$data = [ $data = [
'pesanan' => $result 'pesanan' => $result
......
<?php
require_once __DIR__ . '/../../Soap/DetailPesananSoap.php';
require_once __DIR__ . '/../../Soap/PesananSoap.php';
class TrackDetailController extends Controller{
public function index($id = 0) {
PesananSoap::setSoapClient("pesanan");
$pesanan = PesananSoap::getPesananByIdPesanan($id);
DetailPesananSoap::setSoapClient("detailPesanan");
$detail = DetailPesananSoap::getDetailPesanan($id);
$data = [
'pesanan' => $pesanan,
'detailpesanan' => $detail
];
$this->render($data);
$this->render();
}
}
\ No newline at end of file
<?php <?php
require_once __DIR__ . '/BaseSoap.php'; require_once __DIR__ . '/BaseSoap.php';
class PesananSoap extends BaseSoap{ class DetailPesananSoap extends BaseSoap{
public static SoapClient $client; public static SoapClient $client;
public static string $service; public static string $service;
...@@ -18,7 +18,7 @@ class PesananSoap extends BaseSoap{ ...@@ -18,7 +18,7 @@ class PesananSoap extends BaseSoap{
public static function getDetailPesanan(int $idPesanan){ public static function getDetailPesanan(int $idPesanan){
$result = static::$client->__soapCall('getDetailPesanan', array( $result = static::$client->__soapCall('getDetailPesanan', array(
'addPesanan' => array( 'getDetailPesanan' => array(
'arg0' => $idPesanan 'arg0' => $idPesanan
) )
)); ));
......
...@@ -38,13 +38,26 @@ class PesananSoap extends BaseSoap{ ...@@ -38,13 +38,26 @@ class PesananSoap extends BaseSoap{
} }
public static function getPesanan($userId){ public static function getPesanan($userId){
var_dump($userId);
$result = static::$client->__soapCall('getPesananByIdUser', array( $result = static::$client->__soapCall('getPesananByIdUser', array(
'getPesananByIdUser' => array( 'getPesananByIdUser' => array(
'arg0' => $userId, 'arg0' => $userId,
) )
)); ));
if(empty((array) $result)){
return null;
}
return $result;
}
public static function getPesananByIdPesanan($pesananId){
$result = static::$client->__soapCall('getPesananByIdPesanan', array(
'getPesananByIdPesanan' => array(
'arg0' => $pesananId,
)
));
if(empty((array) $result)){ if(empty((array) $result)){
return null; return null;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment