Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/ledger.corals.io/Corals/modules/Ledger/resources/views/records/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/ledger.corals.io/Corals/modules/Ledger/resources/views/records/create_edit.blade.php
{!! CoralsForm::openForm($record,['data-table' => '.dataTable']) !!}
<div class="row">
    <div class="col-md-4">
        {!! CoralsForm::select('account_id','Ledger::attributes.record.account_id',Corals\Modules\Ledger\Classes\Ledger::getAccounts(), true, null, [], 'select2') !!}
        {!! CoralsForm::date('record_date','Ledger::attributes.record.record_date',true,$record->exists?$record->record_date:today()) !!}
        <div id="amount-wrapper">
            {!! CoralsForm::number('amount','Ledger::attributes.record.amount',true,$record->amount) !!}
        </div>
    </div>
    <div class="col-md-4">
        {!! CoralsForm::radio('type','Ledger::attributes.record.type',true,trans('Ledger::attributes.record.record_type_options')) !!}
        {!! CoralsForm::radio('payment_method','Ledger::attributes.record.payment_method',true,trans('Ledger::attributes.record.payment_method_options')) !!}
        {!! CoralsForm::radio('currency','Ledger::attributes.record.currency',true,config('ledger.supported_currencies')) !!}
    </div>
    <div class="col-md-4 cheque_details">
        {!! CoralsForm::text('properties[cheque_number]','Ledger::labels.cheque.cheque_number',true) !!}
        {!! CoralsForm::text('properties[cheque_name]','Ledger::labels.cheque.cheque_name',true) !!}
        {!! CoralsForm::date('properties[cheque_date]','Ledger::labels.cheque.cheque_date', true)!!}
        {{--        {!! CoralsForm::select('properties[bank_name]','Ledger::labels.cheque.bank_name',ListOfValues::get('Banks'), true,null,[], 'select2') !!}--}}
        {{--        {!! CoralsForm::text('properties[bank_account_number]','Ledger::labels.cheque.bank_account_number',false)!!}--}}
    </div>
</div>
<div class="row">
    <div class="col-md-6">
        {!! CoralsForm::select('item_id','Ledger::attributes.record.item',\Ledger::getItems(), false, null, ['wrapper_class'=>'m-0'], 'select2') !!}
    </div>
    <div class="col-md-4">
        <label style="display: block">&nbsp;</label>
        <button type="button" onclick="addItem()" class="btn btn-info">Add Item</button>
    </div>
</div>
<div class="row d-md-flex mt-3 justify-content-around align-items-center d-none" id="items-header">
    <div class="col-md-3 text-center  p-4 p-md-0">
        @lang('Ledger::attributes.item.name')
    </div>
    <div class="col-md-5 d-flex justify-content-around">
        <span style="width: 90px;">@lang('Ledger::attributes.item.price')</span>
        <span style="width: 90px;">@lang('Ledger::attributes.item.quantity')</span>
        <span style="width: 90px;">@lang('Ledger::attributes.item.amount')</span>
    </div>
    <div class="col-md-3">
        @lang('Ledger::attributes.item.notes')
    </div>
    <div class="col-md-1">
    </div>
</div>

<div id="record_items_list" class="mt-3 mt-md-0">
    @foreach($record->items as $recordItem)
        @include('Ledger::partials.record_item_row')
    @endforeach
</div>
<hr/>
{!! CoralsForm::textarea('notes','Ledger::attributes.record.notes',false) !!}

{!! CoralsForm::formButtons('',[],['show_cancel'=>false],array_merge(
    $record->exists?[]:[[
            'label'=> 'Ledger::labels.record.save_and_clone',
            'type'=> 'submit',
            'attributes'=>['name'=>'save-clone','value'=>'1',
            'class'=>'btn btn-warning mr-md-3'],
        ]],
        [[
            'label'=> $record->exists?'Ledger::labels.record.update_and_confirm':'Ledger::labels.record.create_and_confirm',
            'type'=>'submit',
            'attributes'=>['name'=>'submit-btn','value'=>'confirmed',
            'class'=>'btn btn-danger mr-md-3'],
        ],
        ])) !!}

{!! CoralsForm::closeForm($record) !!}

<script>
    function hideShowAmount() {
        if ($('#record_items_list').find('.item-row').length) {
            $('#amount-wrapper').hide();
            $("#items-header").addClass('d-md-flex');
        } else {
            $("#items-header").removeClass('d-md-flex');
            $('#amount-wrapper').fadeIn();
        }
    }

    function addItem() {
        let item_id = $('#item_id').val();

        if (!item_id) {
            return;
        }
        let itemRow = $('#record_items_list').find(`#item_${item_id}`);

        if (itemRow.length) {
            let quantityForItem = itemRow.find('.quantity')
            let priceForItem = itemRow.find('.price')
            quantityForItem.val(parseFloat(quantityForItem.val()) + 1);
            quantityForItem.trigger('change');
            $('#item_id').val(null).trigger('change');
        } else {
            $.get('{{url('ledger/item-data/')}}/?item_id=' + item_id).then(function (response) {
                $('#record_items_list').append(response.item_details)
                $('#item_id').val(null).trigger('change');
                hideShowAmount();
            });
        }
    }

    function checkRecordType() {
        let val = $('input[name=payment_method]:checked').val();

        if (val === 'cheque') {
            $('.cheque_details').show();
        } else {
            $('.cheque_details').hide();
        }
    }

    $('input[name=payment_method]').change(function () {
        checkRecordType();
    });

    $(document).on('click', '.remove-btn', function () {
        $(this).closest('.item-row').remove();
        hideShowAmount()
    });

    $(document).on('keyup change', '.quantity,.price', function () {
        let row = $(this).closest('.item-row');
        let quantityForItem = row.find('.quantity').val()
        let priceForItem = row.find('.price').val()
        row.find('.amount').val((parseFloat(quantityForItem) * parseFloat(priceForItem)).toFixed(2));
    });

    function initForm() {
        hideShowAmount();
        checkRecordType();
    }

    initForm();
</script>

Spamworldpro Mini