346 lines
13 KiB
PHP
346 lines
13 KiB
PHP
<?php
|
|
$ticketsData = $this->order_tickets;
|
|
$orderInfo = $this->order_info;
|
|
?>
|
|
|
|
<div id="order-data">
|
|
<div class="order-data">
|
|
<div class="container">
|
|
<div class="mini-nav-menu">
|
|
<a href="/apanel/main_view/" class="btn-t1">Lista zamówień</a>
|
|
</div>
|
|
<div class="box_01">
|
|
<input type="hidden" name="order_id" id="order_id" value="<?= $ticketsData[0]['order_id'] ?>">
|
|
<div class="box-tickets-list">
|
|
<table>
|
|
<tr>
|
|
<th>
|
|
<h3>BILETY</h3>
|
|
</th>
|
|
<th>
|
|
<h3>TERMIN</h3>
|
|
</th>
|
|
<th>
|
|
<h3>CENA</h3>
|
|
</th>
|
|
<th>
|
|
<h3>WARTOŚĆ</h3>
|
|
</th>
|
|
<th>
|
|
<h3>ZMIENIĆ ILOŚĆ</h3>
|
|
</th>
|
|
<th>
|
|
<h3>USUŃ</h3>
|
|
</th>
|
|
</tr>
|
|
<?php foreach ($ticketsData as $key => $value) : ?>
|
|
<? $ticketsPrice += $value['price'] * $value['quantity'];?>
|
|
<tr>
|
|
<td><?= $value['name']; ?> ( x <?= $value["quantity"]; ?>)</td>
|
|
<td><?= $value['date_visit'] ? date('d/m/Y', strtotime($value['date_visit'])) : ''; ?></td>
|
|
<td><?= $value['price']; ?> zł</td>
|
|
<td><?= $value['price'] * $value["quantity"]; ?> zł</td>
|
|
<td>
|
|
<? if ( $value['product_id'] != 0 and $value['product_id'] != 999999 ) : ?>
|
|
<button class="btn_t1 add" ticket_id="<?= $key; ?>">
|
|
<i class="fa-solid fa-plus"></i>
|
|
</button>
|
|
<button class="btn_t1 subtract" ticket_id="<?= $key; ?>">
|
|
<i class="fa-solid fa-minus"></i>
|
|
</button>
|
|
<? endif;?>
|
|
</td>
|
|
<td>
|
|
<button class="btn_t1 delete" ticket_id="<?= $key; ?>">
|
|
<i class="fa-solid fa-trash-can"></i>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="box_02">
|
|
<div class="row">
|
|
<div class="order-detale-info col-lg-8 col-md-8 col-xs-12">
|
|
<div class="order-detale-info__wrapper">
|
|
<h2>SZCZEGÓŁY</h2>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="name" class="col-lg-3 col-form-label">Status płatności</label>
|
|
<div class="col-lg-9">
|
|
<select name="payment_status" class="form-control">
|
|
<option value="0" <?= $orderInfo[0]['payment_status'] == 0 ? 'selected' : ''; ?>>Nie zapłacono</option>
|
|
<option value="1" <?= $orderInfo[0]['payment_status'] == 1 ? 'selected' : ''; ?>>Zapłacono</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="name" class="col-lg-3 col-form-label">Imię</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="name" name="name" value="<?= $orderInfo[0]['name']; ?>"
|
|
disabled>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="surname" class="col-lg-3 col-form-label">Nazwisko</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="surname" name="surname"
|
|
value="<?= $orderInfo[0]['surname']; ?>" disabled>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="email" class="col-lg-3 col-form-label">Email</label>
|
|
<div class="col-lg-9">
|
|
<input type="email" class="form-control" id="email" name="email" value="<?= $orderInfo[0]['email']; ?>"
|
|
disabled>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="zip_code" class="col-lg-3 col-form-label">Kod pocztowy</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="zip_code" name="zip_code"
|
|
value="<?= $orderInfo[0]['zip_code']; ?>" disabled>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="city" class="col-lg-3 col-form-label">Miejscowość</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="city" name="city" value="<?= $orderInfo[0]['city']; ?>"
|
|
disabled>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="street" class="col-lg-3 col-form-label">Ulica</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="street" name="street" value="<?= $orderInfo[0]['street']; ?>"
|
|
disabled>
|
|
</div>
|
|
</div>
|
|
|
|
<? if(!empty($orderInfo[0]['gift_address'])) : ?>
|
|
<div class="form-group row mb-lg-2" id="gift_address_box">
|
|
<label for="gift_address" class="col-lg-3 col-form-label">Dane do wysyłki biletu prezentowego</label>
|
|
<div class="col-lg-9">
|
|
<textarea rows="5" type="text" class="form-control" id="gift_address" name="gift_address" disabled><?= $orderInfo[0]['gift_address']; ?></textarea>
|
|
</div>
|
|
</div>
|
|
<? endif; ?>
|
|
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="date-added-ticket" class="col-lg-3 col-form-label">Data dodanie</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="date-added-ticket" name="date-added-ticket"
|
|
value="<?= $orderInfo[0]['date_added']; ?>" disabled>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="date-pay-ticket" class="col-lg-3 col-form-label">Data płatności</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="date-pay-ticket" name="date-pay-ticket"
|
|
value="<?= $orderInfo[0]['payment_date']; ?>" disabled>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="pay-status" class="col-lg-3 col-form-label">Status płatności</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="pay-status" name="pay-status"
|
|
value="<?= $orderInfo[0]['payment_status'] ? 'Zapłacono' : 'Nie zapłacono'; ?>" disabled>
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="ticket-status" class="col-lg-3 col-form-label">Status biletu</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="ticket-status" name="ticket-status"
|
|
value="<?= $orderInfo[0]['used_ticket'] ? 'Wykorzystany' : 'Nie wykorzystany'; ?>" disabled>
|
|
</div>
|
|
</div>
|
|
<? if($orderInfo[0]['used_ticket_date']) : ?>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="ticket-use-date" class="col-lg-3 col-form-label">Data wykorzystania</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="ticket-use-date" name="ticket-use-date"
|
|
value="<?= $orderInfo[0]['used_ticket_date']; ?>" disabled>
|
|
</div>
|
|
</div>
|
|
<? endif; ?>
|
|
<!-- <pre>
|
|
<?= var_dump($orderInfo[0]['vat']); ?>
|
|
</pre> -->
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="date-pay-ticket" class="col-lg-3 col-form-label"><?= $orderInfo[0]['vat'] ? "Faktura" : 'Paragon'; ?></label>
|
|
<div class="col-lg-9">
|
|
<a href="<?= $orderInfo[0]['invoice_url']; ?>"><?= $orderInfo[0]['invoice_url']; ?></a>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if($orderInfo[0]['vat']) : ?>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="company_name" class="col-lg-3 col-form-label">Nazwa firmy</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="company_name" name="company_name" disabled value="<?= $orderInfo[0]['company_name']; ?>">
|
|
</div>
|
|
</div>
|
|
<div class="form-group row mb-lg-2">
|
|
<label for="nip" class="col-lg-3 col-form-label">NIP</label>
|
|
<div class="col-lg-9">
|
|
<input type="text" class="form-control" id="nip" name="nip" disabled value="<?= $orderInfo[0]['nip']; ?>">
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="order-summary col-lg-4 col-md-4 col-xs-12">
|
|
<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>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
// add
|
|
$('body').on('click', '.add', function() {
|
|
var ticket_id = $(this).attr('ticket_id');
|
|
$.ajax({
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/apanel/ticket_inc/',
|
|
data: {
|
|
ticket_id: ticket_id,
|
|
},
|
|
success: function(data) {
|
|
response = jQuery.parseJSON(data);
|
|
$('.box_01 .box-tickets-list').html(response.basket_form);
|
|
$('.box_02 .order-summary').html(response.order_summ);
|
|
$('.btn-save-new-list').attr('disabled', false)
|
|
}
|
|
});
|
|
});
|
|
|
|
// subtract
|
|
$('body').on('click', '.subtract', function() {
|
|
var ticket_id = $(this).attr('ticket_id');
|
|
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/apanel/ticket_dec/',
|
|
data: {
|
|
ticket_id: ticket_id,
|
|
},
|
|
success: function(data) {
|
|
response = jQuery.parseJSON(data);
|
|
$('.box_01 .box-tickets-list').html(response.basket_form);
|
|
$('.box_02 .order-summary').html(response.order_summ);
|
|
$('.btn-save-new-list').attr('disabled', false)
|
|
}
|
|
});
|
|
});
|
|
|
|
//remove
|
|
$('body').on('click', '.delete', function() {
|
|
var ticket_id = $(this).attr('ticket_id');
|
|
$.ajax({
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/apanel/ticket_rem/',
|
|
data: {
|
|
ticket_id: ticket_id,
|
|
},
|
|
success: function(data) {
|
|
response = jQuery.parseJSON(data);
|
|
$('.box_01 .box-tickets-list').html(response.basket_form);
|
|
$('.box_02 .order-summary').html(response.order_summ);
|
|
$('.btn-save-new-list').attr('disabled', false)
|
|
}
|
|
});
|
|
});
|
|
|
|
$( 'body' ).on( 'click', '.btn-delete-order', function(e)
|
|
{
|
|
e.preventDefault();
|
|
var order_id = $(this).attr( 'data-id' );
|
|
$.alert({
|
|
title: 'Pytanie',
|
|
content: 'Na pewno chcesz usunąć wybrane zamówienie?',
|
|
type: 'orange',
|
|
closeIcon: true,
|
|
closeIconClass: 'fa fa-times',
|
|
typeAnimated: true,
|
|
animation: 'opacity',
|
|
columnClass: 'col-12 col-lg-10',
|
|
theme: 'modern',
|
|
icon: 'fa fa-question',
|
|
buttons: {
|
|
confirm: {
|
|
text: 'Tak',
|
|
btnClass: 'btn-success',
|
|
keys: ['enter'],
|
|
action: function() {
|
|
document.location.href = '/apanel/order_delete/order_id=' + order_id;
|
|
}
|
|
},
|
|
cancel: {
|
|
text: 'Nie',
|
|
btnClass: 'btn-dark',
|
|
action: function() {}
|
|
}
|
|
}
|
|
});
|
|
|
|
return false;
|
|
})
|
|
|
|
//save
|
|
$('body').on('click', '.btn-save-new-list', function() {
|
|
$.ajax({
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/apanel/ticket_save/',
|
|
data: {
|
|
order_id: $('#order_id').val(),
|
|
payment_status: $('select[name="payment_status"]').val()
|
|
},
|
|
beforeSend: function() {
|
|
$('.btn-save-new-list').attr('disabled', true)
|
|
},
|
|
complete: function(data) {
|
|
$.alert({
|
|
icon: 'fa-regular fa-face-smile-beam',
|
|
title: 'Zmiany zapisano',
|
|
content: '',
|
|
typeAnimated: true,
|
|
animation: 'scale',
|
|
closeAnimation: 'scale',
|
|
autoClose: 'confirm|10000',
|
|
bgOpacity: '0.5',
|
|
type: 'green',
|
|
theme: 'modern',
|
|
columnClass: 'col-md-6 col-md-offset-3',
|
|
|
|
buttons: {
|
|
confirm: {
|
|
text: 'Zamknij',
|
|
btnClass: 'btn-green btn-alert',
|
|
keys: ['enter'],
|
|
action: function() {}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
})
|
|
});
|
|
</script>
|