<?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"> <div role="tabpanel"> <?php echo Navigation::tabs($tabs)->withAttributes(['role' => 'tablist', 'class' => 'flags']); ?> <?php echo Form::open(['route' => ['admin.order-shipment.update', $order_shipment->id], 'method' => 'PUT', 'secure' => true]); ?> <div class="tab-content"> <?php foreach($tabs as $tab): ?> <div role="tabpanel" class="tab-pane <?php echo $tab['active'] ? 'active' : ''; ?>" id="<?php echo $tab['route']; ?>"> <?php echo ControlGroup::generate( Form::label('title['.$tab['route'].']', trans('admin.fields.title').":"), Form::text('title['.$tab['route'].']', $order_shipment->title($tab['id'])) ); ?> <?php echo ControlGroup::generate( Form::label('description['.$tab['route'].']', trans('admin.fields.description').":"), Form::textarea('description['.$tab['route'].']', $order_shipment->description($tab['id']), ['rows' => 3]) ); ?> </div> <?php endforeach; ?> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php echo trans('admin.labels.shipment-prices'); ?></h3> </div> <div class="panel-body"> <table class="table table-striped order-shipment-postages"> <thead> <tr> <th class="col-xs-4"><?php echo trans('admin.labels.weight-to-kg'); ?></th> <th class="col-xs-4"><?php echo trans('admin.labels.price'); ?></th> <th class="col-xs-2"><?php echo trans('admin.labels.price-with-vat'); ?></th> <?php if(Sentry::getUser()->hasAccess('admin.order-shipment.edit')): ?> <th colspan="2" class="col-xs-2 text-center"><?php echo trans('admin.labels.controls'); ?></th> <?php endif; ?> </tr> </thead> <tbody> <?php foreach($order_shipment->orderShipmentPostages as $index => $order_shipment_postage): ?> <tr> <td class="col-xs-4"> <?php echo Form::text('postage_weight['.$index.']', $order_shipment_postage->weight, ['class' => 'weights']); ?> </td> <td class="col-xs-4"> <?php echo Form::text('postage_price['.$index.']', $order_shipment_postage->price, ['class' => 'prices']); ?> </td> <td class="col-xs-2"> <?php echo Form::checkbox('postage_vat['.$index.']', 1, $order_shipment_postage->vat, ['class' => 'vats']); ?> </td> <?php if(Sentry::getUser()->hasAccess('admin.order-shipment.edit')): ?> <td class="col-xs-1 text-center"> <?php echo Button::danger()->withIcon(Icon::minus())->withAttributes(['class' => 'icon remove-order-shipment-postage']); ?> </td> <td class="col-xs-1 text-center"> <?php echo Button::success()->withIcon(Icon::plus())->withAttributes(['class' => 'icon add-order-shipment-postage']); ?> </td> <?php endif; ?> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title pull-left"><?php echo trans('admin.labels.goods-value-discount'); ?></h3> <h3 class="panel-title text-right"><?php echo trans('admin.labels.has-priority-over-wight'); ?></h3> </div> <div class="panel-body"> <table class="table table-striped order-shipment-condition"> <thead> <tr> <th class="col-xs-4"><?php echo trans('admin.labels.goods-price-from'); ?></th> <th class="col-xs-4"><?php echo trans('admin.labels.price'); ?></th> <th class="col-xs-2"><?php echo trans('admin.labels.price-with-vat'); ?></th> </tr> </thead> <tbody> <tr> <td class="col-xs-4"> <?php echo Form::text('condition_condition', $order_shipment->order_shipment_condition ? $order_shipment->order_shipment_condition->condition : null, ['class' => 'condition']); ?> </td> <td class="col-xs-4"> <?php echo Form::text('condition_price', $order_shipment->order_shipment_condition ? $order_shipment->order_shipment_condition->price : null, ['class' => 'price']); ?> </td> <td class="col-xs-2"> <?php echo Form::checkbox('condition_vat', 1, $order_shipment->order_shipment_condition ? $order_shipment->order_shipment_condition->vat : null, ['class' => 'vat']); ?> </td> </tr> </tbody> </table> </div> </div> <div class="row"> <div class="col-xs-12"> <?php echo ControlGroup::generate( Form::label('countries', trans('admin.fields.countries').":"), Form::select('countries[]', $order_countries, $order_shipment->orderCountries->lists('id'), ['multiple' => 'multiple']) ); ?> <?php echo ControlGroup::generate( Form::label('active', trans('admin.fields.active').":"), Form::checkbox('active', 1, $order_shipment->active) ); ?> </div> </div> <?php if(Sentry::getUser()->hasAccess('admin.order-shipment.update')): ?> <?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-shipment.index')); ?> <?php else: ?> <?php echo Button::primary(trans('admin.buttons.back'))->prependIcon(Icon::arrow_left())->asLinkTo(route('admin.order-shipment.index')); ?> <?php endif; ?> <?php echo Form::close(); ?> </div> </div> </div> <table class="hide order-shipment-postages"> <tr> <td class="col-xs-4"> <?php echo Form::text('postage_weight['.$order_shipment->orderShipmentPostages->count().']', null, ['class' => 'weights']); ?> </td> <td class="col-xs-4"> <?php echo Form::text('postage_price['.$order_shipment->orderShipmentPostages->count().']', null, ['class' => 'prices']); ?> </td> <td class="col-xs-2"> <?php echo Form::checkbox('postage_vat['.$order_shipment->orderShipmentPostages->count().']', 1, null, ['class' => 'vats']); ?> </td> <?php if(Sentry::getUser()->hasAccess('admin.order-shipment.edit')): ?> <td class="col-xs-1 text-center"> <?php echo Button::danger()->withIcon(Icon::minus())->withAttributes(['class' => 'icon remove-order-shipment-postage']); ?> </td> <td class="col-xs-1 text-center"> <?php echo Button::success()->withIcon(Icon::plus())->withAttributes(['class' => 'icon add-order-shipment-postage']); ?> </td> <?php endif; ?> </tr> </table> <?php $__env->stopSection(); ?> <?php $__env->startSection('scripts'); ?> $('form select[name^="countries"]').select2({ placeholder: '<?php echo trans('admin.messages.select-countries'); ?>', theme: 'bootstrap', language: "sk", width: '100%' }); $('form').on('click', '.add-order-shipment-postage', function() { var $table = $(this).parents('table'); var $row = $table.find('tr').last(); var $template = $('table.order-shipment-postages.hide').find('tr'); $clone = $template.clone().insertAfter($row); }); $('form').on('click', '.remove-order-shipment-postage', function() { var $table = $(this).parents('table'); var $rows = $table.find('tr'); var $row = $(this).closest('tr'); if ($rows.length>2) $row.remove(); }); <?php $__env->stopSection(); ?>