ultimatepos/Modules/Accounting/Resources/views/holding/opening_balance.blade.php

65 lines
2.9 KiB
PHP

@extends('layouts.app')
@section('title', __('accounting::lang.opening_balance'))
@section('content')
@include('accounting::layouts.nav')
<section class="content-header"><h1>@lang('accounting::lang.opening_balance')</h1></section>
<section class="content">
<div class="box box-primary">
<form action="{{ url('accounting/opening-balance') }}" method="POST">
@csrf
<div class="box-body">
<div class="row">
<div class="col-md-3">
<label>@lang('lang_v1.date')</label>
<input type="date" name="operation_date" class="form-control" value="{{ date('Y-m-d') }}" required>
</div>
<div class="col-md-9">
<label>@lang('purchase.note')</label>
<input type="text" name="note" class="form-control" value="@lang('accounting::lang.opening_balance')">
</div>
</div>
<hr>
<table class="table table-bordered" id="opening_balance_table">
<thead>
<tr>
<th>@lang('accounting::lang.gl_account')</th>
<th>@lang('accounting::lang.debit')</th>
<th>@lang('accounting::lang.credit')</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>{!! Form::select('account_id[]', $accounts, null, ['class'=>'form-control select2','required']) !!}</td>
<td><input type="number" step="0.01" name="debit[]" class="form-control"></td>
<td><input type="number" step="0.01" name="credit[]" class="form-control"></td>
<td><button type="button" class="btn btn-danger btn-xs remove_row">X</button></td>
</tr>
</tbody>
</table>
<button type="button" class="btn btn-default" id="add_opening_row">+ @lang('messages.add')</button>
</div>
<div class="box-footer">
<button class="btn btn-primary">@lang('accounting::lang.post_opening_balance')</button>
</div>
</form>
</div>
</section>
@endsection
@section('javascript')
<script>
$(function(){
$('#add_opening_row').click(function(){
var row = $('#opening_balance_table tbody tr:first').clone();
row.find('input').val('');
row.find('select').val('');
$('#opening_balance_table tbody').append(row);
row.find('.select2').select2();
});
$(document).on('click', '.remove_row', function(){
if ($('#opening_balance_table tbody tr').length > 1) $(this).closest('tr').remove();
});
});
</script>
@endsection