<commit_before><?php

use common\helpers\Html;
use common\modules\lead\models\LeadMarket;
use common\modules\lead\models\LeadMarketUser;
use common\widgets\grid\ActionColumn;
use common\widgets\GridView;
use yii\data\ActiveDataProvider;
use yii\web\YiiAsset;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model LeadMarket */
/* @var $onlyUser bool */

$showLead = !$onlyUser || $model->hasAccessToLead(Yii::$app->user->getId());

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('lead', 'Leads'), 'url' => ['lead/index']];
if ($showLead) {
	$this->params['breadcrumbs'][] = ['label' => $model->lead->getName(), 'url' => ['lead/view', 'id' => $model->lead_id]];
} else {
	$this->params['breadcrumbs'][] = $model->lead->getName();
}
$this->params['breadcrumbs'][] = ['label' => Yii::t('lead', 'Lead Markets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;

YiiAsset::register($this);
?>
<div class="lead-market-view">

	<h1><?= Html::encode($this->title) ?></h1>

	<p>
		<?= $model->userCanAccessRequest(Yii::$app->user->getId())
			? Html::a(Yii::t('lead', 'Request Access'), ['market-user/access-request', 'market_id' => $model->id], ['class' => 'btn btn-success'])
			: ''
		?>
		<?= $model->isCreatorOrOwnerLead(Yii::$app->user->getId()) || !$onlyUser
			? Html::a(Yii::t('lead', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary'])
			: ''
		?>
		<?= $model->isCreatorOrOwnerLead(Yii::$app->user->getId()) || !$onlyUser
			? Html::a(Yii::t('lead', 'Delete'), ['delete', 'id' => $model->id], [
				'class' => 'btn btn-danger',
				'data' => [
					'confirm' => Yii::t('lead', 'Are you sure you want to delete this item?'),
					'method' => 'post',
				],
			])
			: '' ?>
	</p>

	<div class="row">


		<div class="col-md-5">

			<?= DetailView::widget([
				'model' => $model,
				'attributes' => [
					'statusName',
					'created_at:datetime',
					'updated_at:datetime',
					'creator.fullName:text:' . Yii::t('lead', 'Creator'),
					'lead.owner.fullName:text:' . Yii::t('lead', 'Owner'),
					[
						'value' => $model->getUser(Yii::$app->user->getId())
							? $model->getUser(Yii::$app->user->getId())->reserved_at
							: null,
						'format' => 'date',
						'label' => Yii::t('lead', 'Reserved At'),
						'visible' => $model->getUser(Yii::$app->user->getId()) !== null,
					],
				],
			]) ?>


			<?= $showLead
				? $this->render('_lead', [
					'model' => $model->lead,
				])
				: ''
			?>
		</div>


		<div class="col-md-4">
			<?= $model->isCreatorOrOwnerLead(Yii::$app->user->getId())
				? $this->render('_options_details', [
					'model' => $model->getMarketOptions(),
				])
				: ''
			?>

		</div>
	</div>
<commit_msg>feat: add render address detail when show lead in Market View.<commit_after><?php

use common\helpers\Html;
use common\modules\lead\models\LeadMarket;
use common\modules\lead\models\LeadMarketUser;
use common\widgets\address\AddressDetailView;
use common\widgets\grid\ActionColumn;
use common\widgets\GridView;
use yii\data\ActiveDataProvider;
use yii\web\YiiAsset;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model LeadMarket */
/* @var $onlyUser bool */

$showLead = !$onlyUser || $model->hasAccessToLead(Yii::$app->user->getId());

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Yii::t('lead', 'Leads'), 'url' => ['lead/index']];
if ($showLead) {
	$this->params['breadcrumbs'][] = ['label' => $model->lead->getName(), 'url' => ['lead/view', 'id' => $model->lead_id]];
} else {
	$this->params['breadcrumbs'][] = $model->lead->getName();
}
$this->params['breadcrumbs'][] = ['label' => Yii::t('lead', 'Lead Markets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;

YiiAsset::register($this);
?>
<div class="lead-market-view">

	<h1><?= Html::encode($this->title) ?></h1>

	<p>
		<?= $model->userCanAccessRequest(Yii::$app->user->getId())
			? Html::a(Yii::t('lead', 'Request Access'), ['market-user/access-request', 'market_id' => $model->id], ['class' => 'btn btn-success'])
			: ''
		?>
		<?= $model->isCreatorOrOwnerLead(Yii::$app->user->getId()) || !$onlyUser
			? Html::a(Yii::t('lead', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary'])
			: ''
		?>
		<?= $model->isCreatorOrOwnerLead(Yii::$app->user->getId()) || !$onlyUser
			? Html::a(Yii::t('lead', 'Delete'), ['delete', 'id' => $model->id], [
				'class' => 'btn btn-danger',
				'data' => [
					'confirm' => Yii::t('lead', 'Are you sure you want to delete this item?'),
					'method' => 'post',
				],
			])
			: '' ?>
	</p>

	<div class="row">


		<div class="col-md-5">

			<?= DetailView::widget([
				'model' => $model,
				'attributes' => [
					'statusName',
					'created_at:datetime',
					'updated_at:datetime',
					'creator.fullName:text:' . Yii::t('lead', 'Creator'),
					'lead.owner.fullName:text:' . Yii::t('lead', 'Owner'),
					[
						'value' => $model->getUser(Yii::$app->user->getId())
							? $model->getUser(Yii::$app->user->getId())->reserved_at
							: null,
						'format' => 'date',
						'label' => Yii::t('lead', 'Reserved At'),
						'visible' => $model->getUser(Yii::$app->user->getId()) !== null,
					],
				],
			]) ?>


			<?= $showLead
				? $this->render('_lead', [
					'model' => $model->lead,
				])
				: ''
			?>


			<?= $showLead && $model->lead->getCustomerAddress()
				? AddressDetailView::widget([
					'model' => $model->lead->getCustomerAddress(),
				])
				: ''
			?>
		</div>


		<div class="col-md-4">
			<?= $model->isCreatorOrOwnerLead(Yii::$app->user->getId())
				? $this->render('_options_details', [
					'model' => $model->getMarketOptions(),
				])
				: ''
			?>

		</div>
	</div>

{'fraction_non_alphanumeric': 0.2650539505743126, 'fraction_numerical': 0.0013922728854855553, 'mean_word_length': 3.8497890295358648, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 187, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1547906', 'n_tokens_mistral': 2513, 'n_tokens_neox': 2169, 'n_words': 323}