<div class="box-body">
    <div class="row">
        <div class="col-md-12">
            <table class="table margin-bottom-5" id="budget-lines">
                <thead>
                    <tr>
                        <th>Descrição do produto ou serviço</th>
                        <th class="text-right width-70px">Qt.</th>
                        <th class="text-right width-100px">Pr. Unitário</th>
                        <th class="text-right width-110px">Pr. Liquido</th>
                        <th class="text-right width-70px"></th>
                    </tr>
                </thead>
                <tbody>
                    <?php if($budget->lines->isEmpty()): ?>
                    <tr class="budget-lines-row">
                        <td colspan="5"><i class="text-muted">Não adicionou nenhum produto ou serviço ao orçamento.</i></td>
                    </tr>
                    <?php endif; ?>
                    <?php foreach($budget->lines as $line): ?>
                    <tr class="budget-lines-row">
                        <td>
                            <?php echo $line->description; ?>

                        </td>
                        <td class="text-right">
                            <?php if($line->qtt): ?>
                            <?php echo $line->qtt; ?>

                            <?php endif; ?>
                        </td>
                        <td class="text-right">
                            <?php if($line->price != 0.00): ?>
                            <?php echo money($line->price); ?>€
                            <?php endif; ?>
                        </td>
                        <td class="text-right">
                            <?php if($line->subtotal != 0.00): ?>
                            <?php echo money($line->subtotal); ?>€
                            <?php endif; ?>
                        </td>
                        <td>
                            <div class="action-buttons text-right">
                                <a href="<?php echo route('admin.budgets.lines.show', array($line->budget_id, $line->id)); ?>" data-toggle="modal" data-target="#modal-remote" class="text-green">
                                    <i class="fa fa-pencil bigger-120"></i>
                                </a>
                                <a href="<?php echo route('admin.budgets.lines.destroy', array($line->budget_id, $line->id)); ?>" data-method="delete" data-confirm="Tem a certeza que prentende eliminar a linha selecionada?" class="text-red">
                                    <i class="fa fa-trash-o bigger-120"></i>
                                </a>
                            </div>
                        </td>
                    </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
            <a href="<?php echo route('admin.budgets.lines.create', array($budget->id)); ?>" data-toggle="modal" data-target="#modal-remote" class="btn btn-sm btn-default">
                <i class="fa fa-plus"></i> Adicionar produto ou serviço
            </a>
            <div class="spacer-20"></div>
        </div>
        <div class="col-md-8  col-lg-7">
            <h4 class="text-red">Condições do documento</h4>

            <div class="form-group">
                <?php echo Form::label('payment_conditions', 'Condições de Pagamento', array('class' => 'col-sm-2 control-label')); ?>

                <div class="col-sm-10">
                    <?php if($budget->geral_conditions): ?>
                    <?php echo Form::textarea('payment_conditions',null, array('class' =>'form-control', 'rows' => 3)); ?>

                    <?php else: ?>
                    <?php echo Form::textarea('payment_conditions', $default['payment_conditions'], array('class' =>'form-control', 'rows' => 3)); ?>

                    <?php endif; ?>
                </div>
            </div>
            <div class="form-group">
                <?php echo Form::label('geral_conditions', 'Condições Gerais', array('class' => 'col-sm-2 control-label')); ?>

                <div class="col-sm-10">
                    <?php if($budget->geral_conditions): ?>
                    <?php echo Form::textarea('geral_conditions',null, array('class' =>'form-control', 'rows' => 3)); ?>

                    <?php else: ?>
                    <?php echo Form::textarea('geral_conditions', $default['geral_conditions'], array('class' =>'form-control', 'rows' => 3)); ?>

                    <?php endif; ?>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group is-required">
                        <?php echo Form::label('validity', 'Válido por', array('class' => 'col-sm-4 control-label')); ?>

                        <div class="col-sm-6">
                            <div class="input-group">
                                <?php if($budget->validity): ?>
                                <?php echo Form::text('validity', null, array('class' =>'form-control', 'maxlength' => 3)); ?>

                                <?php else: ?>
                                <?php echo Form::text('validity', 30, array('class' =>'form-control', 'maxlength' => 3)); ?>

                                <?php endif; ?>
                                <span class="input-group-addon">dias</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group is-required">
                        <?php echo Form::label('date', 'Data do doc.', array('class' => 'col-sm-4 control-label')); ?>

                        <div class="col-sm-8">
                            <?php echo Form::text('date', $budget->date->format('Y-m-d'), array('class' =>'form-control datepicker', 'readonly')); ?>

                        </div>
                    </div>
                </div>
            </div>

        </div>
        <div class="col-md-4 col-lg-offset-1">
            <h4 class="text-red">Totais do documento</h4>
            <table class="table">
                <tbody>
                    <tr>
                        <th style="width:40%"><p class="form-control-static bold">Preço liquido</p></th>
                        <td>
                            <div class="input-group">
                                <?php echo Form::text('price', null, array('class' =>'form-control mask-price', 'maxlength' => 10, 'required' => true)); ?>

                                <span class="input-group-addon">€</span>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>IVA (<?php echo $vat; ?>%)</th>
                        <td><?php echo money($budget->vat, '€'); ?></td>
                    </tr>
                    <tr>
                        <th>TOTAL</th>
                        <td><?php echo money($budget->total, '€'); ?></td>
                    </tr>
                </tbody>
            </table>
        </div>

    </div>
</div>
<?php echo Form::hidden('concluded', 0); ?>

<?php echo $__env->make('admin.budgets.partials.footer', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>