update
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
<?
|
||||
global $db;
|
||||
ob_start();
|
||||
$orderId = (int)($this -> order['id'] ?? 0);
|
||||
?>
|
||||
<input type="hidden" name="order_id" value="<?= $this -> order['id'];?>">
|
||||
<div class="details">
|
||||
|
||||
<div class="site-title">Edycja zamówienia: <?= htmlspecialchars((string)($this -> order['number'] ?? ''), ENT_QUOTES, 'UTF-8');?></div>
|
||||
|
||||
<div class="mb15">
|
||||
<button type="button" id="order-save" class="btn btn-success btn-sm mr5 ml5">
|
||||
<i class="fa fa-save"></i> Zapisz zamówienie
|
||||
</button>
|
||||
<a href="/admin/shop_order/order_details/order_id=<?= $orderId;?>" class="btn btn-dark btn-sm mr5">
|
||||
<i class="fa fa-reply"></i> Wstecz
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<form id="fg-order-details" method="POST" action="/admin/shop_order/order_save/">
|
||||
<input type="hidden" name="order_id" value="<?= $orderId;?>">
|
||||
<div class="details panel">
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-xl-8">
|
||||
<div class="row">
|
||||
@@ -71,13 +84,18 @@ ob_start();
|
||||
<? endif;?>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div>Kwota zamówienia <b><?= $this -> order[ 'summary' ];?> zł</b></div>
|
||||
<div>Kwota zamówienia <b id="order-summary-display"><?= $this -> order[ 'summary' ];?> zł</b></div>
|
||||
<div class="mt5">
|
||||
<span>Produkty: <b id="products-total-display">0,00</b> zł</span>
|
||||
|
|
||||
<span>Dostawa: <b id="transport-cost-display"><?= number_format((float)($this -> order['transport_cost'] ?? 0), 2, ',', '');?></b> zł</span>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<select name="transport_id" class="form-control" id="transport_id">
|
||||
<option value="0">--- wybierz formę transportu ---</option>
|
||||
<? if ( \S::is_array_fix( $this -> transport ) ): foreach ( $this -> transport as $transport_tmp ):?>
|
||||
<? if ( \Shared\Helpers\Helpers::is_array_fix( $this -> transport ) ): foreach ( $this -> transport as $transport_tmp ):?>
|
||||
<option value="<?= $transport_tmp['id'];?>" <? if ( $this -> order['transport_id'] == $transport_tmp['id'] ):?>selected="selected"<? endif;?>>
|
||||
<?= $transport_tmp['name'];?> - <?= $transport_tmp['cost'];?> zł
|
||||
</option>
|
||||
@@ -100,7 +118,7 @@ ob_start();
|
||||
<div class="col-12">
|
||||
<select name="payment_method_id" class="form-control" id="payment_method_id">
|
||||
<option value="0">--- wybierz formę płatności ---</option>
|
||||
<? if ( \S::is_array_fix( $this -> payment_methods ) ): foreach ( $this -> payment_methods as $payment_method ):?>
|
||||
<? if ( \Shared\Helpers\Helpers::is_array_fix( $this -> payment_methods ) ): foreach ( $this -> payment_methods as $payment_method ):?>
|
||||
<option value="<?= $payment_method['id'];?>" <? if ( $this -> order['payment_method_id'] == $payment_method['id'] ):?>selected="selected"<? endif;?>>
|
||||
<?= $payment_method['name'];?>
|
||||
</option>
|
||||
@@ -130,7 +148,7 @@ ob_start();
|
||||
<button class="btn btn-success order_status_change">zmień status</button>
|
||||
</div>
|
||||
<div class="col-12 order-history">
|
||||
<? if ( \S::is_array_fix( $this -> order['statuses'] ) ): foreach ( $this -> order['statuses'] as $status ):?>
|
||||
<? if ( \Shared\Helpers\Helpers::is_array_fix( $this -> order['statuses'] ) ): foreach ( $this -> order['statuses'] as $status ):?>
|
||||
<div><b><?= date( 'Y-m-d H:i', strtotime( $status['date'] ) );?></b>: <?= $this -> order_statuses[$status['status_id']];?></div>
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
@@ -147,46 +165,75 @@ ob_start();
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="text-big mb5">Produkty zamówienia:</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<table class="table" id="order-products-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zdjęcie</th>
|
||||
<th style="width:60px">Zdjęcie</th>
|
||||
<th scope="col">Nazwa</th>
|
||||
<th scope="col" class="tab-center">Ilość</th>
|
||||
<th scope="col" class="tab-right">Cena / szt:</th>
|
||||
<th scope="col" class="tab-right">Cena / szt (po rabacie):</th>
|
||||
<th scope="col" class="tab-right">Suma (po rabacie):</th>
|
||||
<th scope="col" class="tab-center" style="width:80px">Ilość</th>
|
||||
<th scope="col" class="tab-right" style="width:130px">Cena / szt:</th>
|
||||
<th scope="col" class="tab-right" style="width:130px">Cena promo:</th>
|
||||
<th scope="col" class="tab-right" style="width:110px">Suma:</th>
|
||||
<th scope="col" style="width:40px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? if ( is_array( $this -> order[ 'products' ] ) ): foreach ( $this -> order[ 'products' ] as $product ):?>
|
||||
<tr class="order-product-details">
|
||||
<tbody id="order-products-body">
|
||||
<? $productRepo = new \Domain\Product\ProductRepository( $GLOBALS['mdb'] ); ?>
|
||||
<? if ( is_array( $this -> order[ 'products' ] ) ): foreach ( $this -> order[ 'products' ] as $i => $product ):?>
|
||||
<tr class="order-product-row" data-index="<?= $i;?>">
|
||||
<input type="hidden" name="products[<?= $i;?>][order_product_id]" value="<?= (int)$product['id'];?>">
|
||||
<input type="hidden" name="products[<?= $i;?>][product_id]" value="<?= (int)$product['product_id'];?>">
|
||||
<input type="hidden" name="products[<?= $i;?>][parent_product_id]" value="<?= (int)($product['parent_product_id'] ?? $product['product_id']);?>">
|
||||
<input type="hidden" name="products[<?= $i;?>][name]" value="<?= htmlspecialchars((string)$product['name'], ENT_QUOTES, 'UTF-8');?>">
|
||||
<input type="hidden" name="products[<?= $i;?>][vat]" value="<?= (float)($product['vat'] ?? 0);?>">
|
||||
<td class="product-image">
|
||||
<? if ( $product['product_id'] ):?>
|
||||
<img src="<?= \shop\Product::getProductImg( (int)$product['product_id'] );?>">
|
||||
<img src="<?= $productRepo->getProductImg( (int)$product['product_id'] );?>" style="max-width:50px;max-height:50px;">
|
||||
<? endif;?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?= \shop\Product::getProductUrl( (int)$product['product_id'] );?>" target="_blank"><?= $product[ 'name' ];?></a>
|
||||
<br />
|
||||
<div class="atributes">
|
||||
<?= $product[ 'attributes' ];?>
|
||||
</div>
|
||||
<br />
|
||||
<div class="product-message">
|
||||
<?= $product[ 'message' ] != '' ? '<strong>Wiadomość:</strong> ' . $product['message'] : '';?>
|
||||
</div>
|
||||
<a href="<?= $productRepo->getProductUrl( (int)$product['product_id'] );?>" target="_blank"><?= $product[ 'name' ];?></a>
|
||||
<? if ( $product['attributes'] ):?>
|
||||
<div class="atributes small text-muted"><?= $product[ 'attributes' ];?></div>
|
||||
<? endif;?>
|
||||
<? if ( $product[ 'message' ] != '' ):?>
|
||||
<div class="product-message small"><strong>Wiadomość:</strong> <?= $product['message'];?></div>
|
||||
<? endif;?>
|
||||
</td>
|
||||
<td class="tab-center">
|
||||
<input type="number" name="products[<?= $i;?>][quantity]" value="<?= (int)$product['quantity'];?>" min="1" class="form-control form-control-sm text-center product-qty" style="width:70px">
|
||||
</td>
|
||||
<td class="tab-right">
|
||||
<input type="number" name="products[<?= $i;?>][price_brutto]" value="<?= number_format((float)$product['price_brutto'], 2, '.', '');?>" step="0.01" min="0" class="form-control form-control-sm text-right product-price" style="width:110px">
|
||||
</td>
|
||||
<td class="tab-right">
|
||||
<input type="number" name="products[<?= $i;?>][price_brutto_promo]" value="<?= number_format((float)$product['price_brutto_promo'], 2, '.', '');?>" step="0.01" min="0" class="form-control form-control-sm text-right product-price-promo" style="width:110px">
|
||||
</td>
|
||||
<td class="tab-right product-row-total">
|
||||
<?= number_format(((float)$product['price_brutto_promo'] > 0 ? (float)$product['price_brutto_promo'] : (float)$product['price_brutto']) * (int)$product['quantity'], 2, ',', '');?> zł
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-xs btn-danger btn-remove-product" title="Usuń produkt"><i class="fa fa-times"></i></button>
|
||||
</td>
|
||||
<td class="tab-center"><?= $product[ 'quantity' ];?></td>
|
||||
<td class="tab-right"><?= $product[ 'price_brutto' ];?> zł</td>
|
||||
<td class="tab-right"><?= $product[ 'price_brutto_promo' ];?> zł</td>
|
||||
<td class="tab-right"><?= $product[ 'price_brutto_promo' ] * $product[ 'quantity' ];?> zł</td>
|
||||
</tr>
|
||||
<? endforeach; endif;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb15" id="add-product-section">
|
||||
<div class="text-big mb5">Dodaj produkt:</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div style="position:relative">
|
||||
<input type="text" id="product-search-input" class="form-control" placeholder="Wpisz nazwę produktu..." autocomplete="off">
|
||||
<div id="product-search-results" style="display:none;position:absolute;z-index:1000;width:100%;max-height:300px;overflow-y:auto;background:#fff;border:1px solid #ddd;border-top:none;box-shadow:0 2px 8px rgba(0,0,0,0.15)"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -199,71 +246,21 @@ ob_start();
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?
|
||||
$out = ob_get_clean();
|
||||
</form>
|
||||
|
||||
$grid = new \gridEdit;
|
||||
$grid -> id = 'order-details';
|
||||
$grid -> gdb_opt = $gdb;
|
||||
$grid -> include_plugins = true;
|
||||
$grid -> title = 'Szczegóły zamówienia: ' . $this -> order[ 'number' ];
|
||||
$grid -> buttons = [
|
||||
[
|
||||
'label' => 'Zapisz zamówienie',
|
||||
'icon' => 'fa-save',
|
||||
'class' => 'btn btn-success btn-sm mr5 ml5',
|
||||
'id' => 'order-save'
|
||||
],
|
||||
[
|
||||
'label' => 'Wstecz',
|
||||
'url' => '/admin/shop_order/order_details/order_id=' . $this -> order['id'],
|
||||
'icon' => 'fa-reply',
|
||||
'class' => 'btn btn-dark btn-sm mr5'
|
||||
]
|
||||
];
|
||||
$grid -> default_buttons = false;
|
||||
$grid -> external_code = $out;
|
||||
echo $grid -> draw();
|
||||
?>
|
||||
<div class="inpost-map-container">
|
||||
<a href="#" onclick="$( '.inpost-map-container' ).hide(); return false;" class="inpost-hide"><?= \S::lang( 'zamknij' );?></a>
|
||||
<a href="#" onclick="$( '.inpost-map-container' ).hide(); return false;" class="inpost-hide"><?= \Shared\Helpers\Helpers::lang( 'zamknij' );?></a>
|
||||
<div id="inpost-map"></div>
|
||||
</div>
|
||||
<link class="footer" rel="stylesheet" type="text/css" href="https://geowidget.easypack24.net/css/easypack.css">
|
||||
<script class="footer" type="text/javascript" src="https://geowidget.easypack24.net/js/sdk-for-javascript.js"></script>
|
||||
<script type="text/javascript">
|
||||
$( function()
|
||||
{
|
||||
$( 'body' ).on( 'change', '#transport_id', function()
|
||||
{
|
||||
if ( $( this ).val() != '2' )
|
||||
$( '#inpost_paczkomat' ).closest( '.row' ).hide();
|
||||
else
|
||||
$( '#inpost_paczkomat' ).closest( '.row' ).show();
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.btn-paczkomat', function()
|
||||
{
|
||||
window.easyPackAsyncInit = function () {
|
||||
easyPack.init({
|
||||
mapType: 'osm',
|
||||
searchType: 'osm',
|
||||
});
|
||||
|
||||
var map = easyPack.mapWidget( 'inpost-map', function(point)
|
||||
{
|
||||
$( '#inpost_paczkomat' ).val( point.name + ' | ' + point.address.line1 + ', ' + point.address.line2 );
|
||||
$( '.inpost-map-container' ).hide();
|
||||
});
|
||||
};
|
||||
$( '.inpost-map-container' ).show();
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '#order-save', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
$( '#fg-order-details' ).attr( 'method', 'POST' ).attr( 'action', '/admin/shop_order/order_save/' ).submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
var orderEditConfig = {
|
||||
transports: <?= $this -> transports_json ?? '[]';?>,
|
||||
freeDelivery: <?= (float)($this -> free_delivery ?? 0);?>,
|
||||
currentTransportCost: <?= (float)($this -> order['transport_cost'] ?? 0);?>
|
||||
};
|
||||
</script>
|
||||
<?= \Shared\Tpl\Tpl::view('shop-order/order-edit-custom-script');?>
|
||||
Reference in New Issue
Block a user