Save
This commit is contained in:
@@ -202,4 +202,18 @@ class Apanel
|
||||
header( 'Location: /apanel/main_view/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function use_ticket() {
|
||||
global $mdb;
|
||||
|
||||
$order_id = \S::get('order_id');
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$mdb->update('orders', ['used_ticket' => 1, 'used_ticket_date' => $date], ['id' => $order_id]);
|
||||
|
||||
echo json_encode([
|
||||
'useStatus' => true
|
||||
]);
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -194,11 +194,20 @@
|
||||
<div class="order-summary__wrapper">
|
||||
<h2>Suma:</h2>
|
||||
<p id="order-general-price"><?= $ticketsPrice; ?> zł</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="flex flex-buttons-group">
|
||||
<button class="btn-t1 btn-save-new-list">Zapisz</button>
|
||||
<a href="#" class="btn btn-danger btn-delete-order" data-id="<?= $orderInfo[0]['id']; ?>">Usuń zamówienie</a>
|
||||
</div>
|
||||
|
||||
<?php if($orderInfo[0]['used_ticket'] == 0) : ?>
|
||||
<hr>
|
||||
<div class="flex flex-buttons-group">
|
||||
<a href="#" class="btn btn-dark btn-accept-order w-100" data-id="<?= $orderInfo[0]['id']; ?>">Oznacz jako wykorzystane</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -342,5 +351,24 @@ $(function() {
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('body').on('click', '.btn-accept-order', function(e) {
|
||||
var order_id = $(this).attr( 'data-id' );
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/apanel/use_ticket/',
|
||||
data: {
|
||||
order_id: order_id,
|
||||
},
|
||||
success: function(data) {
|
||||
response = jQuery.parseJSON(data);
|
||||
if (response.useStatus == true) {
|
||||
alert("Status zmieniono na 'Wykorzystany'")
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user