<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\models\Accounts */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Accounts', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="accounts-view">
    <style>
    .accountdetails {
        border-style: solid;
        border-color: black;
        background: white;
        height: 200px
    }

    .heading {
        font-size: 18pt;
        text-align: center;
        border-bottom: solid black 1;
    }
    </style>

    <div class="row">
        <div class="sidebar col-200 col-12 pr-lg-0">
            <ul class="nav nav-pills nav-stacked">
                <li class="nav-item">
                    <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-submit w-100 update nav-link']) ?>
                </li>
            </ul>

            <div class="spacer"></div>
        </div>

        <div class="col main">            <div class="row">
                <div class="col-12 col-md-6">
                    <div class="card">
                        <div class="card-header">Account Details</div>
                        <div class="card-body">
                            <div class="row">
                                <div class="col-4 col-md-2">ERP ID:</div>
                                <div class="col-8 col-md-4"><?= $model->intid ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Account Name:</div>
                                <div class="col-8 col-md-4"><?= $model->name ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Account Code:</div>
                                <div class="col-8 col-md-4"><?= $model->account_code ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">On Stop:</div>
                                <div class="col-8 col-md-4"><?= $model->stop ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Price Number:</div>
                                <div class="col-8 col-md-4"><?= $model->price_number ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Account Email:</div>
                                <div class="col-8 col-md-4"><?= $model->email ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Sales Person</div>
                                <div class="col-8 col-md-4"><?= $model->salesperson ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Minimum Order for Free Delivery</div>
                                <div class="col-8 col-md-4"><?= $model->minfreedelivery ?></div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="col-sm-6">  
                <?php if (($address = $model->addressl)) { ?>
                    <div class="card">
                        <div class="card-header">Address Details</div>
                        <div class="card-body">
                            <div class="row">
                                <div class="col-4 col-md-2">Address1:</div>
                                <div class="col-8 col-md-4"><?= $address->address1 ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Address2:</div>
                                <div class="col-8 col-md-4"><?= $address->address2 ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Address3:</div>
                                <div class="col-8 col-md-4"><?= $address->address3 ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Town:</div>
                                <div class="col-8 col-md-4"><?= $address->town ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">County:</div>
                                <div class="col-8 col-md-4"><?= $address->county ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Post Code:</div>
                                <div class="col-8 col-md-4"><?= $address->postcode ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Contact:</div>
                                <div class="col-8 col-md-4"><?= $address->contact ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Telephone:</div>
                                <div class="col-8 col-md-4"><?= $address->telephone ?></div>
                            </div>
                            <div class="row">
                                <div class="col-4 col-md-2">Fax:</div>
                                <div class="col-8 col-md-4"><?= $address->fax ?></div>
                            </div>
                        </div>
                    </div>
                <?php } ?>
                </div>

                
                <div class="col-sm-12">
                    <div class="card">
                        <div class="card-header">Extended Details</div>
                        <div class="card-body">
                            <div class="row">
                                <?php  $exdata = $model->extended; ?>
                                <?php foreach ($exdata->attributes as $key => $att) { ?>
                                    <div class="col-sm-12 col-md-6">
                                        <span class="font-weight-bold">
                                            <label><?= $exdata->getAttributeLabel($key); ?>:</label>
                                    </span>
                                        <?php if (is_array($exdata->$key) || is_object($exdata->$key)) {  ?>
                                            <ul>
                                                <?php foreach ($exdata->$key as $name => $item) {?>
                                                    <li><span class="font-weight-bold"><?= $name ?>: </span><?= $item ?></li>
                                                <?php }?>
                                            </ul>
                                        <?php  } else { ?>
                                            <?= $exdata->$key  ?>
                                        <?php  }  ?>
                                    </div>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="col-sm-12">
                    <div class="card">
                        <div class="card-header">Update Details</div>
                        <div class="card-body">
                            <div class="row">
                                <div class="col-12 col-sm-3">
                                    <label class="font-weight-bold">
                                        <?= $model->getAttributeLabel('created_at') ?>:
                                    </label>
                                    <?= date('d-m-Y H:i:s', $model->created_at);  ?>
                                </div>
                                <div class="col-12 col-sm-3">
                                    <label class="font-weight-bold">
                                        <?= $model->getAttributeLabel('createdby_name') ?>:
                                    </label>
                                    <?= $model->createdby_name;  ?>
                                </div>
                                <div class="col-12 col-sm-3">
                                    <label class="font-weight-bold">
                                        <?= $model->getAttributeLabel('updated_at') ?>:
                                    </label>
                                    <?= date('d-m-Y H:i:s', $model->updated_at);  ?>
                                </div>
                                <div class="col-12 col-sm-3">
                                    <label class="font-weight-bold">
                                        <?= $model->getAttributeLabel('updatedby_name') ?>:
                                    </label>
                                    <?= $model->updatedby_name;  ?>
                                </div>
                                <div class="col-12 col-sm-3">
                                    <label class="font-weight-bold">
                                        <?= $model->getAttributeLabel('deleted_at') ?>:
                                    </label>
                                    <?= $model->deleted_at  ?>
                                </div>
                                <div class="col-12 col-sm-3">
                                    <label class="font-weight-bold">
                                        <?= $model->getAttributeLabel('deletedby_name') ?>:
                                    </label>
                                    <?= $model->deletedby_name;  ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>