

<?php $__env->startSection('title'); ?>
    Customer Detail
<?php $__env->stopSection(); ?>
<?php $__env->startSection('css'); ?>
    <style>
        hr {
            margin-top: 5px;
            margin-bottom: 5px;
        }
    </style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('breadcrumb'); ?>
    <ol class="breadcrumb pull-right">
        <li><a href="<?php echo e(route('home')); ?>"><i class="fa fa-dashboard"></i> Home</a></li>
        <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'list-customer')): ?>
            <li><a href="<?php echo e(route('customer.all')); ?>">Customers</a></li>
        <?php endif; ?>
        <li class="active">Customer Detail</li>
    </ol>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>



    <div class="container-fluid">
        <div class="row colorbox-group-widget">
            <div class="col-md-3 col-xs-12 p-0">
                <div class="col-md-12 col-xs-12">
                    <div class="white-box1">
                        <div class="user-bg">
                            <div class="overlay-box">
                                <div class="user-content">
                                    <?php if($customer->img_url): ?>
                                        <img src="<?php echo e(asset('uploads/' . $customer->img_url)); ?>" alt="user-img"
                                            class="thumb-lg img-circle">
                                    <?php else: ?>
                                        <img src="<?php echo e(asset('plugins/images/users/jeffery.png')); ?>" width="auto"
                                            alt="user-img" class="thumb-lg img-circle">
                                    <?php endif; ?>
                                    <h4 class="text-white">
                                        <?php
                                            
                                            $ownerArray[] = $customer->name;
                                            
                                            if (!empty($customer->first_owner)) {
                                                $ownerArray[] = $customer->first_owner;
                                            }
                                            
                                            if (!empty($customer->second_owner)) {
                                                $ownerArray[] = $customer->second_owner;
                                            }
                                            
                                        ?>

                                        <?php if(count($ownerArray) > 1): ?>
                                            <?php echo e('Joint Owners'); ?>

                                        <?php else: ?>
                                            <?php echo e($customer->name); ?>

                                        <?php endif; ?>

                                    </h4>
                                    <h5 class="text-white"><?php echo e($customer->mobile_number); ?></h5>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-9 col-xs-12 p-0">
                <!-- <div class="col-md-3 col-sm-6 info-color-box">
                            <div class="white-box1">
                                <div class="profile-widget">
                                    <div class="profile-img">
                                        <?php if($customer->img_url): ?>
    <img src="<?php echo e(asset('uploads/' . $customer->img_url)); ?>" height="100px" width="auto" alt="user-img" class="img-circle">
<?php else: ?>
    <img src="<?php echo e(asset('plugins/images/users/jeffery.png')); ?>" height="100px" width="auto" alt="user-img" class="img-circle">
    <?php endif; ?>
                                        <p class="m-t-10 m-b-5"><h3><?php echo e($customer->name); ?></h3> </p>
                                        
                                    </div>
                                </div>
                            </div>
                        </div> -->

                <!-- <div class="col-md-3 col-sm-6 info-color-box">
                             <div class="white-box1">
                                <div class="media bg-success">
                                    <div class="media-body"><ul>
                                        <?php $__currentLoopData = $customer->properties; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <li><h5 class="info-count" style="font-size: 14px;"><?php echo e($p->membership_no); ?><span class="pull-right"></span></h5></li>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </ul>
                                        <p class="info-ot font-20"> Client ids</p>
                                    </div>

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

                <div class="col-md-4 col-sm-12 info-color-box">
                    <div class="white-box">
                        <div class="media bg-primary">
                            <div class="media-body">
                                <h3 class="info-count"><?php echo e(number_format($received)); ?><span class="pull-right"><i
                                            class="mdi mdi-checkbox-marked-circle-outline"></i></span></h3>
                                <p class="info-text font-12">PKR </p>
                                <p class="info-ot font-20"> Paid Amount</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-sm-12 info-color-box">
                    <div class="white-box">
                        <div class="media bg-warning">
                            <div class="media-body">
                                <h3 class="info-count"><?php echo e(number_format($dueAmount)); ?><span class="pull-right"><i
                                            class="mdi mdi-checkbox-marked-circle-outline"></i></span></h3>
                                <p class="info-text font-12">PKR </p>
                                <p class="info-ot font-20"> Due Amount</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-4 col-sm-12 info-color-box">
                    <div class="white-box">
                        <div class="media bg-info">
                            <div class="media-body">
                                <h3 class="info-count"><?php echo e(number_format($outstandingAmt)); ?><span class="pull-right"><i
                                            class="mdi mdi-checkbox-marked-circle-outline"></i></span></h3>
                                <p class="info-text font-12">PKR </p>
                                <p class="info-ot font-20"> Outstanding Amt</p>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- <div class="col-md-6">
                            <div class="white-box ecom-stat-widget" style="padding: 2px 15px 2px 15px;">
                                <div class="row">
                                    <div class="col-xs-12">
                                        <p class="font-12"><b>Reference #</b></p>
                                        <ol>
                                                <?php $__currentLoopData = $customer->properties; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <?php if($p->membership_no): ?>
    <li><?php echo e($p->membership_no); ?></li>
<?php else: ?>
    <li style="color: #e8e8e8"> Not Approved</li>
    <?php endif; ?>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </ol>
                                    </div>
                                </div>
                            </div>
                        </div> -->
                <!-- <div class="col-md-6">
                            <div class="white-box ecom-stat-widget" style="padding: 2px 15px 2px 15px;">
                                <div class="row">
                                    <div class="col-xs-12">
                                        <p class="font-12"><b>Invoices</b></p>
                                        <ol>
                                            <?php $__currentLoopData = $customer->properties; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <li><?php echo e($p->invoice_number); ?></li>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </ol>
                                    </div>
                                </div>
                            </div>
                        </div> -->
            </div>
        </div>
    </div>
    <!-- /row -->
    <div class="row container-fluid">
        <div class="col-sm-12">
            <div class="white-box1">
                <h3 class="box-title" style="display: inline-block;">Basic Information</h3>
                <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'edit-customer')): ?>
                    <a class="btn btn-outline btn-default waves-effect waves-light pull-right"
                        href="<?php echo e(route('customer.editView', ['id' => $customer->id])); ?>"style="margin-top: 9px"> <i
                            class="fa fa-pencil m-r-5"></i> <span>Edit</span></a>
                <?php endif; ?>

                <hr>
                <div class="table-responsive">
                    <table class="table">
                        <tbody>
                            <tr>



                                <td>Code </td>
                                <td>

                                    <?php $words = explode(' ', $customer->name);
                                    $acronym = '';
                                    foreach ($words as $w) {
                                        $acronym .= $w;
                                    }
                                    ?>

                                    <?php echo e($acronym); ?>00<?php echo e($customer->id); ?>


                                </td>
                            </tr>


                            <?php if(count($ownerArray) > 1): ?>
                                <tr>
                                    <td>Names </td>
                                    <td>
                                        <?php echo e($customer->name); ?>, <?php echo e($customer->first_owner); ?>,
                                        <?php echo e($customer->second_owner); ?>

                                    </td>
                                </tr>
                            <?php endif; ?>


                            <tr style="display: <?= $customer->type == 1 ? 'none' : '' ?>">

                                <?php if($customer->father_type == 1): ?>
                                    <td><b>S/O,<strike> D/O, W/O</strike></b></td>
                                <?php elseif($customer->father_type == 2): ?>
                                    <td><b><strike>S/O,</strike> D/O,<strike> W/O</strike></b></td>
                                <?php elseif($customer->father_type == 3): ?>
                                    <td><b><strike>S/O, D/O,</strike> W/O</b></td>
                                <?php else: ?>
                                    <td><b>S/O, D/O, W/O</b></td>
                                <?php endif; ?>
                                <td>

                                    <?php if(count($ownerArray) > 1): ?>
                                        <?php echo e($customer->father_name); ?>, <?php echo e($customer->first_owner_father); ?>,
                                        <?php echo e($customer->second_owner_father); ?>

                                    <?php else: ?>
                                        <?php echo e($customer->father_name); ?>

                                    <?php endif; ?>

                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <b>
                                        <?= $customer->type == 1 ? 'Incorporation no' : 'CNIC' ?>

                                    </b>

                                </td>
                                <td>

                                    <?php if(count($ownerArray) > 1): ?>
                                        <?php echo e(str_replace('_', '', $customer->cnic)); ?>, <?php echo e($customer->first_owner_cnic); ?>,
                                        <?php echo e($customer->second_owner_cnic); ?>

                                    <?php else: ?>
                                        <?php echo e(str_replace('_', '', $customer->cnic)); ?>

                                    <?php endif; ?>



                                </td>
                            </tr>
                            <tr style="display: <?= $customer->type == 1 ? 'none' : '' ?>">
                                <td><b>Passport No.</b></td>
                                <td> <?php echo e($customer->passport_no); ?> </td>
                            </tr>
                            <tr>
                                <td>
                                    <b>
                                        <?= $customer->type == 1 ? 'Date of Incorporation ' : 'Date of Birth' ?>

                                    </b>
                                </td>
                                <td><?php echo e(date('d-m-Y', strtotime($customer->dob))); ?> </td>
                            </tr>
                            <tr>
                                <td>
                                    <b>
                                        <?= $customer->type == 1 ? 'Type Of Company ' : 'Occupation' ?>

                                    </b>
                                </td>
                                <td> <?php echo e($customer->occupation); ?> </td>
                            </tr>

                            <!-- <tr>
                                                        <td>Fingerprint</td>
                                                        <td>
                                                           <?php if(isset($customer->fingerplace)): ?>
    {
                                                               <?php echo e($customer->fingerplace); ?>

                                                            }
<?php else: ?>
    <span>Not Verified</span>
    <?php endif; ?>
                                                        </td>
                                                    </tr> -->

                            <tr>
                                <td>
                                    <b>
                                        <?= $customer->type == 1 ? 'Company Registered Address' : 'Mailing Address' ?>

                                    </b>
                                </td>
                                <td> <?php echo e($customer->mailing_address); ?> </td>
                            </tr>
                            <tr style="display: <?= $customer->type == 1 ? 'none' : '' ?>">
                                <td><b>Permanent Address</b></td>
                                <td> <?php echo e($customer->permanent_address); ?> </td>
                            </tr>
                            <tr>
                                <td><b>Email</b></td>
                                <td> <?php echo e($customer->email); ?> </td>
                            </tr>
                            <tr style="display: <?= $customer->type == 1 ? 'none' : '' ?>">
                                <td><b>Residence Number</b></td>
                                <td> <?php echo e($customer->res_number); ?> </td>
                            </tr>
                            <tr>
                                <td><b>Mobile Number</b></td>
                                <td> <?php echo e($customer->mobile_number); ?> </td>
                            </tr>

                            <tr>
                                <td><b>Is Filer</b></td>
                                <td> <?php echo e($customer->is_filer ? 'YES' : 'NO'); ?> </td>
                            </tr>
                            <tr>
                                <td><b>NTN Number</b></td>
                                <td> <?php echo e($customer->ntn_number); ?> </td>
                            </tr>

                            <tr>
                                <td><b>Updated at</b></td>
                                <td> <?php echo e($customer->updated_at); ?></td>
                            </tr>
                            <tr>
                                <td><b>Created at</b></td>
                                <td> <?php echo e($customer->created_at); ?></td>
                            </tr>

                        </tbody>
                    </table>
                </div>

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



    <!--  <div class="row container-fluid">
                        <div class="col-sm-12">
                            <div class="white-box1">
                                <h3 class="box-title">Bank Detail</h3><hr>
                                        <div class="table-responsive col-md-12">
                                            <table class="table">
                                                <tbody>

                                                 
                                                    <tr>
                                                        <td><b>Account title</b></td>
                                                        <td> <?php echo e($customer->account_title); ?> </td>
                                                    </tr>
                                                    <tr>
                                                        <td><b>Bank</b></td>
                                                        <td> <?php echo e($customer->depositerBank ? $customer->depositerBank->name : ''); ?> </td>
                                                    </tr>
                                                    <tr>
                                                        <td><b>IBAN Number</b></td>
                                                        <td> <?php echo e($customer->iban_number); ?> </td>
                                                    </tr>

                                                  

                                                </tbody>
                                            </table>
                                        </div>
                            </div>
                        </div>
                    </div> -->
    <!-- /.row -->





    <!-- /.row -->



    <div class="row container-fluid">
        <div class="col-sm-12">
            <div class="white-box1">
                <h3 class="box-title">Nominee Information</h3>
                <hr>

                <?php if($customer->nominee): ?>
                    <?php $__currentLoopData = $customer->nominee; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $n): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="table-responsive col-md-6">
                            <table class="table">
                                <tbody>
                                    <tr>
                                        <td><b>Name Of Nominee</b></td>
                                        <td> <?php echo e($n->nominee_name); ?> </td>
                                    </tr>
                                    <tr>
                                        <?php if($n->so_do_wo_flag == 1): ?>
                                            <td><b>S/O,<strike> D/O, W/O</strike></b></td>
                                        <?php elseif($n->so_do_wo_flag == 2): ?>
                                            <td><b><strike>S/O,</strike> D/O,<strike> W/O</strike></b></td>
                                        <?php elseif($n->so_do_wo_flag == 3): ?>
                                            <td><b><strike>S/O, D/O,</strike> W/O</b></td>
                                        <?php else: ?>
                                            <td><b>S/O, D/O, W/O</b></td>
                                        <?php endif; ?>
                                        <td> <?php echo e($n->nominee_so_do_wo); ?> </td>
                                    </tr>
                                    <tr>
                                        <td><b>CNIC</b></td>
                                        <td> <?php echo e($n->nominee_cnic); ?> </td>
                                    </tr>
                                    <tr>
                                        <td><b>Passport No.</b></td>
                                        <td> <?php echo e($n->nominee_passport_no); ?> </td>
                                    </tr>

                                    <tr>
                                        <td><b>Email</b></td>
                                        <td> <?php echo e($n->nominee_email); ?> </td>
                                    </tr>

                                    <tr>
                                        <td><b>Residence Number</b></td>
                                        <td> <?php echo e($n->nominee_res_number); ?> </td>
                                    </tr>
                                    <tr>
                                        <td><b>Mobile Number</b></td>
                                        <td> <?php echo e($n->nominee_mobile_number); ?> </td>
                                    </tr>

                                    <tr>
                                        <td><b>Relation With Applicant</b></td>
                                        <td> <?php echo e($n->nominee_relation); ?> </td>
                                    </tr>





                                </tbody>
                            </table>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php endif; ?>
            </div>
        </div>
    </div>
    <!-- /.row -->

    <div class="row container-fluid">
        <div class="col-sm-12">
            <div class="white-box1">
                <h3 class="box-title" style="display: inline-block;">File Bank</h3>
                <a class="btn btn-primary" onclick="$('#exampleModal').modal();"
                    style="font-size: 16px; display: inline-block;float: right;"><i
                        class="fa fa-file" style="text-transform: none;">&nbsp;</i>Add New</a>
                <hr>
                <div class="table-responsive col-md-12">

                    <?php $c = 1; ?>
                    <?php $__currentLoopData = $customer->documents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="col-md-3">
                            <label><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo e($c++); ?>.</b>
                                &nbsp;&nbsp;<a onclick="openFileModal('<?php echo e($d->id); ?>')"
                                    style="font-size: 12px;cursor: pointer;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</i><u>Rename</u></a></label><br>

                            <a target="_blank" href="<?php echo e(asset('uploads/' . $d->url)); ?>">

                                <?php if(strpos($d->url, 'docx') !== false): ?>
                                    <img src="<?php echo e(asset('uploads/word.png')); ?>" width="175" height="100" />
                                <?php elseif(strpos($d->url, 'pdf') !== false): ?>
                                    </script>

                                    <iframe src="<?php echo e(asset('uploads/' . $d->url)); ?>" width="175" height="100" />
                                    </iframe>
                                <?php else: ?>
                                    <embed src="<?php echo e(asset('uploads/' . $d->url)); ?>" width="175" height="100" />
                                <?php endif; ?>






                                <br>
                                <label style="font-size: 12px; cursor: pointer;"><b>&nbsp;<?php echo e($d->name); ?></b></label>
                            </a>
                            <br>
                            <?php if(strpos($d->url, 'docx') !== false): ?>
                                <a target="_blank" style="color:blue;text-decoration: underline;font-size: 11px"
                                    href="<?php echo e(asset('uploads/' . $d->url)); ?>"><i class="fa fa-download"
                                        style="text-transform: none;">&nbsp;</i>Download</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <?php else: ?>
                                <a target="_blank" style="color:blue;text-decoration: underline;font-size: 11px"
                                    href="<?php echo e(asset('uploads/' . $d->url)); ?>"><i class="fa fa-eye"
                                        style="text-transform: none;">&nbsp;</i>Preview</a>&nbsp;&nbsp;

                                <a target="_blank" style="color:blue;text-decoration: underline;font-size: 11px"
                                    href="<?php echo e(asset('uploads/' . $d->url)); ?>" download=""> <i class="fa fa-download"
                                        style="text-transform: none;">&nbsp;</i>Download</a>&nbsp;&nbsp;
                            <?php endif; ?>
                            <a style="color:red;text-decoration: underline;font-size: 11px"
                                href="<?php echo e(route('customer.delete.document', ['id' => $d->id])); ?>"data-toggle="confirmation"
                                data-title="Are you sure to delete?"><i class="fa fa-trash"
                                    style="text-transform: none;">&nbsp;</i>Delete</a>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                </div>

            </div>
        </div>
    </div>
    <!-- /.row -->

    <div class="row container-fluid">
        <div class="col-md-12">
            <div class="white-box1 user-table">
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="box-title">Follow up history</h4>
                        <!-- <a href="<?php echo e(route('statement.addViewCustomer', ['id' => $customer->id])); ?>">Add New</a> -->
                        <hr>
                    </div>

                </div>
                <div class="table-responsive" style=" overflow-y: auto; max-height: 400px">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>Created at</th>
                                <th>Unit #</th>
                                <th>Remarks</th>
                                <th>Next Follow up Date</th>


                            </tr><?php $count = 1; ?>
                            <?php $__currentLoopData = $followUps; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $f): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e(date('d-m-Y h:i', strtotime($f->created_at))); ?></td>
                                    <td><?php echo e($f->property->inventory->unit_number); ?></td>
                                    <td><?php echo e($f->remarks); ?></td>

                                    <td><?php echo e(date('d-m-Y', strtotime($f->next_follow_up))); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row container-fluid">
        <div class="col-md-12">
            <div class="white-box1 user-table">
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="box-title"><?= $customer->type == 1 ? 'Company' : 'Customer' ?> Properties</h4>
                        <!-- <a href="<?php echo e(route('statement.addViewCustomer', ['id' => $customer->id])); ?>">Add New</a> -->
                        <hr>
                    </div>

                </div>
                <div class="table-responsive" style=" overflow-y: auto; max-height: 400px">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>Unit #</th>
                                <th>Unit Size</th>
                                <th>Total Cost</th>
                                <th>Received Amount</th>
                                <th>Remaining Amount</th>
                                <th>Booking Date</th>
                                <th>Status</th>
                                <th>View</th>
                            </tr><?php $count = 1; ?>
                            <?php $__currentLoopData = $customer->properties; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $property): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($property->inventory->unit_number); ?></td>
                                    <td><?php echo e($property->inventory->size ? $property->inventory->size->name : ''); ?> 
                                        <?php
	$size=  '';

	if( $property->multiProject->project_type_id == \App\ProjectType::society)
    {
      	$size=        \App\ProjectType::society_size;
	}

	else
	{
		$size=   \App\ProjectType::high_rise_size;
	}
                                            
?>
                                        <?php echo e($size); ?></td>

                                    <td><?php echo e(number_format($property->net_pay)); ?></td>

                                    <td>
                                        <?php echo e(number_format($property->statement->sum('received'))); ?>

                                    </td>

                                    <td>
                                        <?php echo e(number_format($property->net_pay - $property->statement->sum('received'))); ?>

                                    </td>

                                    <td> <?php echo e(date('d-m-Y', strtotime($property->booking_date))); ?></td>


                                    <?php if($property->status == \App\CustomerProperty::pending): ?>
                                        <td><span class="label label-primary"
                                                style="background-color:#cd703d;">Pending</span></td>
                                    <?php elseif($property->status == \App\CustomerProperty::approved): ?>
                                        <td><span class="label label-success">Approved</span></td>
                                    <?php elseif($property->status == \App\CustomerProperty::cancel): ?>
                                        <td><span class="label label-danger">Canceled</span></td>
                                    <?php elseif($property->status == \App\CustomerProperty::block): ?>
                                        <td><span class="label label-danger"
                                                style="background-color:#f40909;">Blocked</span></td>
                                    <?php else: ?>
                                        <td></td>
                                    <?php endif; ?>
                                    <td>
                                        <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-membership')): ?>
                                            <a target="_blank" href="<?php echo e(route('statement.detail', ['id' => $property->id])); ?>"
                                                data-toggle="tooltip" data-original-title="View"> <i
                                                    class="fa fa-eye text-inverse m-r-10"></i> &nbsp;&nbsp;&nbsp; </a>
                                        <?php endif; ?>

                                        <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'download-statement')): ?>
                                            <a target="_blank" href="<?php echo e(route('customer.download', ['id' => $property->id])); ?>"
                                                data-toggle="tooltip" data-original-title="Download"> <i
                                                    class="fa fa-download text-inverse m-r-10"></i> </a>
                                        <?php endif; ?>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>






    <div class="row container-fluid">
        <div class="col-md-12">
            <div class="white-box1">
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="box-title" style="display: inline-block;">Transfer Properties Detail</h4>

                        <hr>
                    </div>

                </div>
                <div class="table-responsive" style=" overflow-y: auto; max-height: 400px">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>Unit #</th>
                                <th>Unit Size</th>
                                <th>Total Amount Paid</th>
                                <th>Transfer To</th>
                                <th>Status</th>
                                <th>Transfer Date</th>
                                <th>Detail</th>

                            </tr>


                        </thead>
                        <tbody>

                            <?php $__currentLoopData = $transferproperty; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>

                                    <td>
                                        <?php echo e($tr->property ? $tr->property->inventory->unit_number : ''); ?>

                                    </td>
                                    <td>
                                        <?php echo e($tr->property ? $tr->property->inventory->size->name : ''); ?>

                                     
                                        <?php
                                        $size=  '';

                                        if( $tr->property->multiProject->project_type_id == \App\ProjectType::society)
                                        {
                                              $size=        \App\ProjectType::society_size;
                                        }
                                    
                                        else
                                        {
                                            $size=   \App\ProjectType::high_rise_size;
                                        }
                                                                                
                                    ?>
                                        <?php echo e($size); ?>

                                    </td>
                                    <td>
                                        <?php echo e($tr->amount_paid); ?>

                                    </td>
                                    <td>
                                        <a href='<?php echo e(route('customer.detail', $tr->transfer->id)); ?>'>
                                            <?php echo e($tr->transfer->name); ?>

                                        </a>


                                    </td>
                                    <td>
                                        <span class="label label-success">
                                            Transfered
                                        </span>
                                    </td>
                                    <td>
                                        <?php echo e(date('d-m-Y', strtotime($tr->transfer_date))); ?>

                                    </td>

                                    <td>
                                        <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'view-membership')): ?>
                                            <a target="_blank"
                                                href="<?php echo e(route('customer.transfer.property.history', ['id' => $tr->id])); ?>"
                                                data-toggle="tooltip" data-original-title="View"> <i
                                                    class="fa fa-eye text-inverse m-r-10"></i> &nbsp;&nbsp;&nbsp; </a>
                                        <?php endif; ?>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>




    <div class="row container-fluid">
        <div class="col-md-12">
            <div class="white-box1">
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="box-title" style="display: inline-block;">Transaction Records</h4>
                        <?php if (\Illuminate\Support\Facades\Blade::check('permission', 'create-receipt')): ?>
                            <a class="btn btn-outline btn-default waves-effect waves-light pull-right"
                                href="<?php echo e(route('receipt.addView')); ?>" style="margin-top: 6px;"> <i
                                    class="fa fa-plus m-r-5"></i> <span>Add new</span></a>
                        <?php endif; ?>
                        <hr>
                    </div>

                </div>
                <div class="table-responsive" style=" overflow-y: auto; max-height: 400px">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>Unit # </th>
                                <th>Payment Head </th>
                                <th>Payment Mode </th>

                                <th> Amount</th>
                                <th> Status</th>
                                <th>Date</th>
                            </tr>
                            <?php $count = 1;
                            
                            $customerReceipts = json_decode(json_encode($customer->receipts), true);
                            
                            usort($customerReceipts, function ($a, $b) {
                                return preg_replace('/[^0-9.]/', '', $a['property']['inventory']['unit_number']) <=> preg_replace('/[^0-9.]/', '', $b['property']['inventory']['unit_number']);
                            });
                            
                            $customerReceipts = json_decode(json_encode($customerReceipts));
                            ?>
                            <?php $__currentLoopData = $customerReceipts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $receipt): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>


                                    <td><?php echo e($receipt->property ? $receipt->property->inventory->unit_number : 0); ?></td>

                                    <?php if($receipt->payment_head == \App\Receipt::possession_fee): ?>
                                        <td>Possession Fee</td>
                                    <?php elseif($receipt->payment_head == \App\Receipt::down_payment): ?>
                                        <td>Down Payment</td>
                                    <?php elseif($receipt->payment_head == \App\Receipt::installment): ?>
                                        <td>Installment</td>
                                    <?php elseif($receipt->payment_head == \App\Receipt::other): ?>
                                        <td>Other</td>
                                    <?php elseif($receipt->payment_head == \App\Receipt::transfer_fee): ?>
                                        <td>Transfer Fee</td>
                                    <?php else: ?>
                                        <td></td>
                                    <?php endif; ?>

                                    <?php if($receipt->payment_mode == \App\Receipt::cash): ?>
                                        <td>Cash</td>
                                    <?php elseif($receipt->payment_mode == \App\Receipt::bank): ?>
                                        <td>Bank transfer</td>
                                    <?php elseif($receipt->payment_mode == \App\Receipt::cheque): ?>
                                        <td>Cheque</td>
                                        <?php else: ?>
                                        <td></td>
                                    <?php endif; ?>


                                    <td><?php echo e(number_format($receipt->amount)); ?> PKR</td>


                                    <?php if($receipt->property->status == \App\CustomerProperty::cancel): ?>
                                        <td>
                                            <span class="label label-danger">Canceled</span>
                                        </td>
                                    <?php else: ?>
                                        <?php if($receipt->is_approved == \App\Receipt::approve): ?>
                                            <td>
                                                <span class="label label-success">
                                                    Approved
                                                </span>
                                            </td>
                                        <?php else: ?>
                                            <?php if($receipt->cheaque_status == \App\Receipt::cancel): ?>
                                                <td>
                                                    <span class="label label-danger">
                                                        Cheaque Cancel
                                                    </span>
                                                </td>
                                            <?php else: ?>
                                                <td>
                                                    <span class="label label-warning">
                                                        Pending
                                                    </span>
                                                </td>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                    <?php endif; ?>

                                    <td> <?php echo e(date('d-m-Y', strtotime($receipt->receipt_date))); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>











    </div>
    <!-- /.container-fluid -->

    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
        aria-hidden="true">

        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header" style="text-align: center;">
                    <h5 class="modal-title" id="exampleModalLabel">New File</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <form method="post" action="<?php echo e(route('customer.document.upload')); ?>" enctype="multipart/form-data">
                    <?php echo e(csrf_field()); ?>

                    <div class="modal-body" style="height: 250px;">
                        <input type="hidden" name="customer_id" value="<?php echo e($customer->id); ?>">

                        <div class="form-group form-group-sm">
                            <div class="col-xs-4">
                                <label>File Name</label>
                            </div>
                            <div class="col-xs-8">
                                <input type="text" name="name" placeholder="Enter Name" class="form-control">
                            </div>
                        </div>
                        <div class="form-group form-group-sm">
                            <div class="col-xs-4">
                                <label>File</label>
                            </div>
                            <div class="col-xs-8">
                                <input type="file" name="file" class="form-control">
                            </div>
                        </div>
                        <br>
                    </div>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                        <button type="submit" class="btn btn-primary">Upload</button>
                    </div>
                </form>
            </div>
        </div>

    </div>

    <div class="modal fade" id="exampleModal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
        aria-hidden="true">

    </div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>

    <script type="text/javascript">
        function openFileModal(file_id) {

            var data = {
                'document_id': file_id
            };
            $.get('/update_document_name', data, function(data) {
                document.getElementById('exampleModal1').innerHTML = data;
                $('#exampleModal1').modal();
            });
        }
    </script>



<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\erpv7\resources\views/customer/detail-customer.blade.php ENDPATH**/ ?>