<?php $__env->startSection('content'); ?> <div class="row"> <div class="col-xs-12"> <?php echo Breadcrumb::withLinks($breadcrumbs); ?> </div> </div> <div class="row"> <div class="col-xs-12"> <?php echo Form::open(['id' => 'order', 'route' => ['admin.order.update', $order->id], 'method' => 'PUT', 'secure' => true]); ?> <div class="row"> <div class="col-xs-12"> <?php echo ControlGroup::generate( Form::label('id', trans('admin.fields.order-number').":"), Form::select('id', $orders, $order->id) ); ?> <?php echo ControlGroup::generate( Form::label('state', trans('admin.fields.order-state').":"), Form::select('state', $order_states, $order->state, $order->complete ? null : ['disabled']) ); ?> <?php echo ControlGroup::generate( Form::label('paid', trans('admin.fields.payment-state').":"), Form::select('paid', $payment_states, $order->paid, $order->complete ? null : ['disabled']) ); ?> </div> </div> <div class="row"> <div class="col-xs-12"> <table class="table table-striped"> <thead> <tr> <th class="col-xs-2"><?php echo trans('admin.labels.helios'); ?></th> <th><?php echo trans('admin.labels.product'); ?></th> <th class="text-center"><?php echo trans('admin.labels.quantity'); ?></th> <th class="col-xs-2 text-right"><?php echo trans('admin.labels.item-price'); ?></th> <th class="col-xs-2 text-right"><?php echo trans('admin.labels.summary-price'); ?></th> </tr> </thead> <tbody> <?php $__empty_1 = true; foreach($order_items as $order_item): $__empty_1 = false; ?> <tr> <td class="col-xs-2"><?php echo $order_item['helios']; ?></td> <td><?php echo $order_item['book_title']; ?></td> <td class="text-center"><?php echo $order_item['quantity']; ?></td> <td class="col-xs-2 text-right"><?php echo number_format($order_item['price_item'], 2, ',', ' '); ?> &euro;</td> <td class="col-xs-2 text-right"><?php echo number_format($order_item['price'], 2, ',', ' '); ?> &euro;</td> </tr> <?php endforeach; if ($__empty_1): ?> <tr> <td colspan="5" class="text-center"> <?php echo trans('admin.messages.empty-list-of-orders'); ?> </td> </tr> <?php endif; ?> </tbody> </table> </div> </div> <?php if($order->message): ?> <div class="row"> <div class="col-xs-12"> <div class="well"> <strong><?php echo trans('admin.labels.message'); ?></strong><br><br> <?php echo $order->message; ?> </div> </div> </div> <?php endif; ?> <?php if(!$order->complete): ?> <div class="row"> <div class="col-xs-12"> <div class="well text-center warning"> <?php if($order->state=='new'): ?> <strong><?php echo trans('admin.messages.order-is-incomplete'); ?></strong><br><br> <?php if(Sentry::getUser()->hasAccess('admin.order.update')): ?> <?php echo Button::danger(trans('admin.buttons.set-order-as-complete-and-paid'))->prependIcon(Icon::ok())->submit()->addAttributes(['class' => 'complete']); ?> <?php echo Button::warning(trans('admin.buttons.cancel-order'))->prependIcon(Icon::remove())->submit()->addAttributes(['class' => 'abort']); ?><br><br> <small><?php echo trans('admin.messages.don-not-use-this-feature-if-not-sure'); ?></small> <?php endif; ?> <?php elseif($order->state=='abort'): ?> <strong><?php echo trans('admin.messages.order-is-aborted'); ?></strong> <?php endif; ?> </div> </div> </div> <?php endif; ?> <div class="row"> <div class="col-xs-5"> <strong><?php echo trans('admin.labels.billing-address'); ?></strong><br><br> <address> <p> <?php echo $order->first_name; ?> <?php echo $order->last_name; ?><br> <?php if(!empty($order->billing_company)): ?> <?php echo $order->billing_company; ?><br> <?php endif; ?> <?php echo $order->billing_street; ?><br> <?php echo $order->billing_postcode; ?>, <?php echo $order->billing_city; ?><br> <?php echo $order_countries[$order->billing_country]; ?> </p> <p> <?php if(!empty($order->billing_ico) && !isGeneratedIco($order->billing_ico)): ?> <?php echo trans('admin.labels.ico'); ?>: <?php echo $order->billing_ico; ?><br> <?php endif; ?> <?php if(!empty($order->billing_dic)): ?> <?php echo trans('admin.labels.dic'); ?>: <?php echo $order->billing_dic; ?><br> <?php endif; ?> <?php if(!empty($order->billing_icdph)): ?> <?php echo trans('admin.labels.icdph'); ?>: <?php echo $order->billing_icdph; ?> <?php endif; ?> </p> </address> <strong><?php echo trans('admin.labels.shipment-address'); ?></strong><br><br> <?php if($order_shipment->type=='post-address' || $order_shipment->type=='post-office' || $order_shipment->type=='post-box' || $order_shipment->type=='courier-dhl' || $order_shipment->type=='post-czech' || $order_shipment->type=='post-europe'): ?> <address> <?php if($order_shipment->type!='post-office' && $order_shipment->type!='post-box'): ?> <?php echo $order->shipment_first_name ? $order->shipment_first_name : $order->first_name; ?> <?php echo $order->shipment_last_name ? $order->shipment_last_name : $order->last_name; ?> <br> <?php endif; ?> <?php if(!empty($order->shipment_company)): ?> <?php echo $order->shipment_company; ?><br> <?php endif; ?> <?php echo $order->shipment_street; ?><br> <?php echo $order->shipment_postcode; ?>, <?php echo $order->shipment_city; ?><br> <?php echo $order_countries[$order->shipment_country]; ?> </address> <?php else: ?> <address> <?php echo $order_shipment->title($language->id); ?> </address> <?php endif; ?> <strong><?php echo trans('admin.labels.contact-data'); ?></strong><br><br> <address> <a href="mailto:<?php echo $order->email; ?>"><?php echo $order->email; ?></a><br> <?php echo $order->phone_number; ?> </address> </div> <div class="col-xs-7"> <div class="well order-details"> <strong><?php echo trans('admin.labels.order-details'); ?></strong><br><br> <dl class="dl-horizontal"> <dt><?php echo trans('admin.labels.for-goods'); ?>:</dt> <dd><?php echo number_format($order->price_goods, 2, ',', ' '); ?> &euro;</dd> </dl> <dl class="dl-horizontal"> <dt><?php echo trans('admin.labels.for-shipment'); ?>:</dt> <dd><?php echo number_format($order->price_shipment, 2, ',', ' '); ?> &euro;</dd> </dl> <dl class="dl-horizontal"> <dt><?php echo trans('admin.labels.summary-price'); ?>:</dt> <dd class="bold"><?php echo number_format($order->price, 2, ',', ' '); ?> &euro;</dd> </dl> <br> <dl> <dt><?php echo trans('admin.labels.payment'); ?>:</dt> <?php if($payment && $order_payment->type == 'ecard'): ?> <dd><?php echo link_to_route('admin.payment-ecard.show', $order_payment->title($language->id), [$payment->id]); ?></dd> <?php elseif($payment && $order_payment->type == 'epay'): ?> <dd><?php echo link_to_route('admin.payment-epay.show', $order_payment->title($language->id), [$payment->id]); ?></dd> <?php else: ?> <dd><?php echo $order_payment->title($language->id); ?></dd> <?php endif; ?> </dl> <dl> <dt><?php echo trans('admin.labels.shipment'); ?>:</dt> <dd><?php echo $order_shipment->title($language->id); ?></dd> </dl> <?php if($order->shipment_number && $order->shipment_date): ?> <dl class="dl-horizontal"> <dt><?php echo trans('admin.fields.shipment-number'); ?>:</dt> <dd><?php echo $order->shipment_number; ?></dd> </dl> <dl class="dl-horizontal"> <dt><?php echo trans('admin.fields.shipment-date'); ?>:</dt> <dd><?php echo $order->shipment_date; ?></dd> </dl> <?php endif; ?> </div> <?php if($revisions->count()): ?> <div class="well order-revisions"> <table class="table table-striped"> <thead> <tr> <th><?php echo trans('admin.labels.revision'); ?></th> <th><?php echo trans('admin.labels.state'); ?></th> <th><?php echo trans('admin.labels.date'); ?></th> </tr> </thead> <tbody> <tr> <td class="name"><?php echo mb_ucfirst(trans('validation.attributes.state')); ?></td> <td class="value"><?php echo trans('admin.labels.order-state-new'); ?></td> <td class="date"><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span> <?php echo date('j.n.Y', strtotime($order->created_at)); ?> <span class="glyphicon glyphicon-time" aria-hidden="true"></span> <?php echo date('H:i:s', strtotime($order->created_at)); ?></td> </tr> <?php foreach($revisions as $revision): ?> <tr> <td class="name"><?php echo mb_ucfirst(trans('validation.attributes.' . $revision->fieldName())); ?></td> <?php if(!is_null($revision->user_id)): ?> <td class="value"><?php echo HTML::linkRoute('admin.user.show', trans('admin.labels.order-' . $revision->fieldName() . '-' . $revision->newValue()), [$revision->userResponsible()->id], ['title' => $revision->userResponsible()->first_name . ' ' . $revision->userResponsible()->last_name]); ?></td> <?php else: ?> <td class="value"><?php echo trans('admin.labels.order-' . $revision->fieldName() . '-' . $revision->newValue()); ?></td> <?php endif; ?> <td class="date"><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span> <?php echo date('j.n.Y', strtotime($revision->created_at)); ?> <span class="glyphicon glyphicon-time" aria-hidden="true"></span> <?php echo date('H:i:s', strtotime($revision->created_at)); ?></td> </tr> <?php endforeach; ?> </tbody> </table> </div> <?php endif; ?> </div> </div> <?php if($order_shipment->type=='post-address' || $order_shipment->type=='post-office' || $order_shipment->type=='post-box' || $order_shipment->type=='courier-dhl' || $order_shipment->type=='post-czech' || $order_shipment->type=='post-europe'): ?> <?php echo Form::hidden('shipment_number', $order->shipment_number); ?> <?php echo Form::hidden('shipment_date', $order->shipment_date); ?> <?php endif; ?> <?php if(!$order->complete): ?> <?php echo Form::hidden('state', $order->state); ?> <?php echo Form::hidden('paid', $order->paid); ?> <?php endif; ?> <?php echo Form::hidden('complete', $order->complete); ?> <?php echo Form::hidden('state_confirmed', 0); ?> <?php echo Form::hidden('paid_confirmed', 0); ?> <?php echo Form::hidden('input_prompted', 0); ?> <?php if(Sentry::getUser()->hasAccess('admin.order.update') && $order->complete): ?> <?php echo Button::success(trans('admin.buttons.store'))->prependIcon(Icon::ok())->submit(); ?> <?php echo Button::danger(trans('admin.buttons.cancel'))->prependIcon(Icon::remove())->asLinkTo(route('admin.order.index')); ?> <?php else: ?> <?php echo Button::primary(trans('admin.buttons.back'))->prependIcon(Icon::arrow_left())->asLinkTo(route('admin.order.index')); ?> <?php endif; ?> <?php echo Form::close(); ?> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startSection('modals'); ?> <div id="confirmState" class="modal fade" role="dialog" aria-labelledby="" aria-hidden="true"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"><?php echo trans('admin.labels.confirm-email-send'); ?></h4> </div> <div class="modal-body"> <?php echo trans('admin.messages.realy-send-email', ['state' => '<span class="state"></span>']); ?> </div> <div class="modal-footer"> <?php echo Form::open(['id' => 'confirm_state', 'method' => 'GET']); ?> <?php echo Button::success(trans('admin.buttons.confirm'))->prependIcon(Icon::ok())->submit(); ?> <?php echo Button::normal(trans('admin.buttons.close'))->withAttributes(['data-dismiss' => 'modal']); ?> <?php echo Form::close(); ?> </div> </div> </div> </div> <div id="promptInput" class="modal fade" role="dialog" aria-labelledby="" aria-hidden="true"> <div class="modal-dialog modal-md"> <div class="modal-content"> <?php echo Form::open(['id' => 'prompt_input', 'method' => 'GET']); ?> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"><?php echo trans('admin.labels.enter-additional-input'); ?></h4> </div> <div class="modal-body"> <?php echo ControlGroup::generate( Form::label('shipment_number', trans('admin.fields.shipment-number').":"), Form::text('shipment_number', $order->shipment_number) ); ?> <?php echo ControlGroup::generate( Form::label('shipment_date', trans('admin.fields.shipment-date').":"), Form::text('shipment_date', $order->shipment_date, ['class' => 'date']) ); ?> </div> <div class="modal-footer"> <?php echo Button::success(trans('admin.buttons.confirm'))->submit(); ?> <?php echo Button::normal(trans('admin.buttons.close'))->withAttributes(['data-dismiss' => 'modal']); ?> </div> <?php echo Form::close(); ?> </div> </div> </div> <div id="confirmComplete" class="modal fade" role="dialog" aria-labelledby="" aria-hidden="true"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"><?php echo trans('admin.labels.confirm-order-state-change'); ?></h4> </div> <div class="modal-body"> <?php echo trans('admin.messages.realy-set-state-to-complete-and-paid'); ?> </div> <div class="modal-footer"> <?php echo Form::open(['id' => 'confirm_state', 'method' => 'GET']); ?> <?php echo Button::success(trans('admin.buttons.confirm'))->prependIcon(Icon::ok())->submit(); ?> <?php echo Button::normal(trans('admin.buttons.close'))->withAttributes(['data-dismiss' => 'modal']); ?> <?php echo Form::close(); ?> </div> </div> </div> </div> <div id="confirmAbort" class="modal fade" role="dialog" aria-labelledby="" aria-hidden="true"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"><?php echo trans('admin.labels.confirm-order-state-change'); ?></h4> </div> <div class="modal-body"> <?php echo trans('admin.messages.realy-abort-order'); ?> </div> <div class="modal-footer"> <?php echo Form::open(['id' => 'confirm_state', 'method' => 'GET']); ?> <?php echo Button::success(trans('admin.buttons.confirm'))->prependIcon(Icon::ok())->submit(); ?> <?php echo Button::normal(trans('admin.buttons.close'))->withAttributes(['data-dismiss' => 'modal']); ?> <?php echo Form::close(); ?> </div> </div> </div> </div> <div id="confirmPaid" class="modal fade" role="dialog" aria-labelledby="" aria-hidden="true"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"><?php echo trans('admin.labels.confirm-order-paid-change'); ?></h4> </div> <div class="modal-body"> <?php echo trans('admin.messages.realy-set-paid-to-true'); ?> </div> <div class="modal-footer"> <?php echo Form::open(['id' => 'confirm_paid', 'method' => 'GET']); ?> <?php echo Button::success(trans('admin.buttons.confirm'))->prependIcon(Icon::ok())->submit(); ?> <?php echo Button::normal(trans('admin.buttons.close'))->withAttributes(['data-dismiss' => 'modal']); ?> <?php echo Form::close(); ?> </div> </div> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startSection('scripts'); ?> var indexOf = function(needle) { if(typeof Array.prototype.indexOf === 'function') { indexOf = Array.prototype.indexOf; } else { indexOf = function(needle) { var i = -1, index = -1; for(i = 0; i < this.length; i++) { if(this[i] === needle) { index = i; break; } } return index; }; } return indexOf.call(this, needle); }; $('form select[name=id]').on('change', function() { var id = $(this).val(); var url = '<?php echo route('admin.order.edit', ['~id~']); ?>'; location.assign(url.replace('~id~', id)); }); $('form#order button.complete').on('click', function() { $('form#order').find('input[name=state]').val('new'); $('form#order').find('input[name=complete]').val(1); $('form#order').find('input[name=paid]').val(1); }); $('form#order button.abort').on('click', function() { $('form#order').find('input[name=state]').val('abort'); $('form#order').find('input[name=complete]').val(0); $('form#order').find('input[name=paid]').val(0); }); $('form#order').on('submit', function() { var state = $(this).find('select[name=state]').val(); var paid = parseInt($(this).find('select[name=paid]').val()); var complete = parseInt($(this).find('input[name=complete]').val()); var state_confirmed = parseInt($(this).find('input[name=state_confirmed]').val()); var paid_confirmed = parseInt($(this).find('input[name=paid_confirmed]').val()); var input_prompted = parseInt($(this).find('input[name=input_prompted]').val()); var states = []; states['store'] = ['veda-sav', 'veda-stefanikova']; states['done'] = ['post-address', 'post-office', 'post-box', 'courier-dhl', 'post-czech', 'post-europe']; states['abort'] = ['post-address', 'post-office', 'post-box', 'courier-dhl', 'veda-sav', 'veda-stefanikova', 'post-czech', 'post-europe']; var payments = ['banking', 'ecard', 'epay', 'deposit']; if (!state_confirmed && <?php echo $order->complete ? 'false' : 'true'; ?>) { var modal = complete ? $('#confirmComplete') : $('#confirmAbort'); modal.modal('show'); return false; } if (!paid_confirmed && paid && paid!=<?php echo $order->paid; ?> && indexOf.call(payments, '<?php echo $order_payment->type; ?>')!=-1) { var modal = $('#confirmPaid'); modal.modal('show'); return false; } if (!input_prompted && state!='<?php echo $order->state; ?>' && state=='done' && indexOf.call(states['done'], '<?php echo $order_shipment->type; ?>')!=-1) { var modal = $('#promptInput'); modal.modal('show'); return false; } if (!state_confirmed && state!='<?php echo $order->state; ?>' && states[state] && indexOf.call(states[state], '<?php echo $order_shipment->type; ?>')!=-1) { var modal = $('#confirmState'); var state = $(this).find('select[name=state] option:selected').text(); modal.find('span.state').text(state); modal.modal('show'); return false; } }); $('form#prompt_input').on('submit', function() { var shipment_number = $(this).find('input[name="shipment_number"]').val(); var shipment_date = $(this).find('input[name="shipment_date"]').val(); if (!shipment_number || !shipment_date) return false; $('form#order').find('input[name=shipment_number]').val(shipment_number); $('form#order').find('input[name=shipment_date]').val(shipment_date); $('form#order').find('input[name=input_prompted]').val(1); $('#promptInput').modal('hide'); setTimeout(function() { $('form#order').submit(); }, 333); return false; }); $('form#confirm_paid').on('submit', function() { $('form#order').find('input[name=paid_confirmed]').val(1); $('#confirmPaid').modal('hide'); setTimeout(function() { $('form#order').submit(); }, 333); return false; }); $('form#confirm_state').on('submit', function() { $('form#order').find('input[name=state_confirmed]').val(1); $('form#order').submit(); return false; }); $('form#prompt_input input.date').datepicker({ format: "d.m.yyyy", weekStart: 1, language: "sk", keyboardNavigation: false, autoclose: true, todayHighlight: true }); <?php $__env->stopSection(); ?>