|
|
@@ -49,220 +49,167 @@ $this->addBreadcrumb($this->getTitle()) ; |
|
|
|
$this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphicon-plus"></span>', 'url' => 'producer-admin/create', 'class' => 'btn btn-primary']) ; |
|
|
|
|
|
|
|
?> |
|
|
|
<div class="producer-admin-index"> |
|
|
|
|
|
|
|
<div class="alert alert-info"> |
|
|
|
Facturé le mois dernier : <strong><?= $sumPrices ?> €</strong><br /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<?= GridView::widget([ |
|
|
|
'dataProvider' => $dataProviderProducer, |
|
|
|
'columns' => [ |
|
|
|
[ |
|
|
|
'attribute' => 'active', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
$html = '' ; |
|
|
|
if($model->active) { |
|
|
|
$html .= '<span class="label label-success">En ligne</span>' ; |
|
|
|
} |
|
|
|
else { |
|
|
|
$html .= '<span class="label label-danger">Hors-ligne</span>' ; |
|
|
|
} |
|
|
|
|
|
|
|
<div class="alert alert-info"> |
|
|
|
Facturé le mois dernier : <strong><?= $sumPrices ?> €</strong><br /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<?= GridView::widget([ |
|
|
|
'dataProvider' => $dataProviderProducer, |
|
|
|
'columns' => [ |
|
|
|
[ |
|
|
|
'attribute' => 'active', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
$html = '' ; |
|
|
|
if($model->active) { |
|
|
|
$html .= '<span class="label label-success">En ligne</span>' ; |
|
|
|
} |
|
|
|
else { |
|
|
|
$html .= '<span class="label label-danger">Hors-ligne</span>' ; |
|
|
|
} |
|
|
|
|
|
|
|
if(strlen($model->code)) |
|
|
|
{ |
|
|
|
$html .= ' <span class="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="bottom" data-original-title="'.Html::encode($model->code).'"></span>' ; |
|
|
|
} |
|
|
|
|
|
|
|
return $html ; |
|
|
|
} |
|
|
|
], |
|
|
|
'name', |
|
|
|
/*[ |
|
|
|
'attribute' => 'date_creation', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
return date('d/m/Y', strtotime($model->date_creation)) ; |
|
|
|
} |
|
|
|
],*/ |
|
|
|
/*[ |
|
|
|
'attribute' => 'Lieu', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
return Html::encode($model->city.' ('.$model->postcode.')') ; |
|
|
|
} |
|
|
|
],*/ |
|
|
|
/*[ |
|
|
|
'attribute' => 'Utilisateurs', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
if(!$model->userProducer || !count($model->userProducer)) |
|
|
|
{ |
|
|
|
return 'Aucun utilisateur' ; |
|
|
|
} |
|
|
|
else { |
|
|
|
$users = count($model->userProducer).' client' ; |
|
|
|
if(count($model->userProducer) > 1) { |
|
|
|
$users .= 's' ; |
|
|
|
if(strlen($model->code)) |
|
|
|
{ |
|
|
|
$html .= ' <span class="glyphicon glyphicon-lock" data-toggle="tooltip" data-placement="bottom" data-original-title="'.Html::encode($model->code).'"></span>' ; |
|
|
|
} |
|
|
|
return $users ; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
],*/ |
|
|
|
[ |
|
|
|
'attribute' => 'Contact', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
if(!isset($model->user) || (isset($model->user) && count($model->user) == 0)) |
|
|
|
{ |
|
|
|
return 'Aucun contact' ; |
|
|
|
|
|
|
|
return $html ; |
|
|
|
} |
|
|
|
else { |
|
|
|
foreach($model->user as $u) |
|
|
|
], |
|
|
|
'name', |
|
|
|
[ |
|
|
|
'attribute' => 'Contact', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
if(!isset($model->user) || (isset($model->user) && count($model->user) == 0)) |
|
|
|
{ |
|
|
|
if($u->status == User::STATUS_PRODUCER) |
|
|
|
return 'Aucun contact' ; |
|
|
|
} |
|
|
|
else { |
|
|
|
foreach($model->user as $u) |
|
|
|
{ |
|
|
|
return Html::encode($u->lastname.' '.$u->name) |
|
|
|
.'<br />'.Html::encode($u->email) |
|
|
|
.'<br />'.Html::encode($u->phone) ; |
|
|
|
if($u->status == User::STATUS_PRODUCER) |
|
|
|
{ |
|
|
|
return Html::encode($u->lastname.' '.$u->name) |
|
|
|
.'<br />'.Html::encode($u->email) |
|
|
|
.'<br />'.Html::encode($u->phone) ; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
/*[ |
|
|
|
'attribute' => 'Prix libre', |
|
|
|
'label' => 'Prix libre', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($model) { |
|
|
|
if(is_null($model->free_price)) { |
|
|
|
return '' ; |
|
|
|
} |
|
|
|
else { |
|
|
|
$str = ''; |
|
|
|
if($model->isBillingTypeFreePrice()) { |
|
|
|
$str .= '<strong>'; |
|
|
|
} |
|
|
|
|
|
|
|
$str .= $model->getFreePrice(); |
|
|
|
|
|
|
|
if($model->isBillingTypeFreePrice()) { |
|
|
|
$str .= '</strong>'; |
|
|
|
} |
|
|
|
|
|
|
|
return $str; |
|
|
|
} |
|
|
|
} |
|
|
|
],*/ |
|
|
|
[ |
|
|
|
'label' => 'Facturation', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($producer) use ($producerManager) { |
|
|
|
|
|
|
|
$str = ''; |
|
|
|
$str .= '<ul style="margin: 0px;padding-left: 15px;">'; |
|
|
|
], |
|
|
|
[ |
|
|
|
'label' => 'Facturation', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($producer) use ($producerManager) { |
|
|
|
|
|
|
|
$isBillingFrequencyMonthly = $producerManager->isBillingFrequencyMonthly($producer); |
|
|
|
$summaryMonthly = $producerManager->getSummaryAmountsToBeBilled($producer, 'Mois dernier', 1); |
|
|
|
$isBillingFrequencyQuaterly = $producerManager->isBillingFrequencyQuarterly($producer); |
|
|
|
$summaryQuaterly = $producerManager->getSummaryAmountsToBeBilled($producer, '3 derniers mois', 3); |
|
|
|
$isBillingFrequencyBiannual = $producerManager->isBillingFrequencyBiannual($producer); |
|
|
|
$summaryBiannual = $producerManager->getSummaryAmountsToBeBilled($producer, '6 derniers mois', 6); |
|
|
|
$str = ''; |
|
|
|
$str .= '<ul style="margin: 0px;padding-left: 15px;">'; |
|
|
|
|
|
|
|
$isBillingFrequencyMonthly = $producerManager->isBillingFrequencyMonthly($producer); |
|
|
|
$summaryMonthly = $producerManager->getSummaryAmountsToBeBilled($producer, 'Mois dernier', 1); |
|
|
|
$isBillingFrequencyQuaterly = $producerManager->isBillingFrequencyQuarterly($producer); |
|
|
|
$summaryQuaterly = $producerManager->getSummaryAmountsToBeBilled($producer, '3 derniers mois', 3); |
|
|
|
$isBillingFrequencyBiannual = $producerManager->isBillingFrequencyBiannual($producer); |
|
|
|
$summaryBiannual = $producerManager->getSummaryAmountsToBeBilled($producer, '6 derniers mois', 6); |
|
|
|
|
|
|
|
if(($isBillingFrequencyMonthly && $summaryMonthly) |
|
|
|
|| ($isBillingFrequencyQuaterly && $summaryQuaterly) |
|
|
|
|| ($isBillingFrequencyBiannual && $summaryBiannual)) { |
|
|
|
|
|
|
|
$str .= '<li>'; |
|
|
|
if ($isBillingFrequencyMonthly && $summaryMonthly) { |
|
|
|
$str .= $summaryMonthly; |
|
|
|
} elseif ($isBillingFrequencyQuaterly && $summaryQuaterly) { |
|
|
|
$str .= $summaryQuaterly; |
|
|
|
} elseif ($isBillingFrequencyBiannual && $summaryBiannual) { |
|
|
|
$str .= $summaryBiannual; |
|
|
|
} |
|
|
|
|
|
|
|
if(($isBillingFrequencyMonthly && $summaryMonthly) |
|
|
|
|| ($isBillingFrequencyQuaterly && $summaryQuaterly) |
|
|
|
|| ($isBillingFrequencyBiannual && $summaryBiannual)) { |
|
|
|
if ($producer->option_billing_reduction && strlen($str)) { |
|
|
|
$str .= '<br /><u>Avec réduction</u> : '; |
|
|
|
if ($producer->option_billing_reduction_percentage) { |
|
|
|
$str .= ' ' . $producer->option_billing_reduction_percentage . ' %'; |
|
|
|
} |
|
|
|
} |
|
|
|
$str .= '</li>'; |
|
|
|
|
|
|
|
$str .= '<li>'; |
|
|
|
if ($isBillingFrequencyMonthly && $summaryMonthly) { |
|
|
|
$str .= $summaryMonthly; |
|
|
|
} elseif ($isBillingFrequencyQuaterly && $summaryQuaterly) { |
|
|
|
$str .= $summaryQuaterly; |
|
|
|
} elseif ($isBillingFrequencyBiannual && $summaryBiannual) { |
|
|
|
$str .= $summaryBiannual; |
|
|
|
$str .= '<li>Facturation '.strtolower(Producer::$billingFrequencyArray[$producer->option_billing_frequency]).'</li>'; |
|
|
|
} |
|
|
|
|
|
|
|
if ($producer->option_billing_reduction && strlen($str)) { |
|
|
|
$str .= '<br /><u>Avec réduction</u> : '; |
|
|
|
if ($producer->option_billing_reduction_percentage) { |
|
|
|
$str .= ' ' . $producer->option_billing_reduction_percentage . ' %'; |
|
|
|
} |
|
|
|
if($producer->option_billing_permanent_transfer) { |
|
|
|
$str .= '<li>Virement permanent : <strong>'.Price::format($producer->option_billing_permanent_transfer_amount).'</strong></li>'; |
|
|
|
} |
|
|
|
$str .= '</li>'; |
|
|
|
|
|
|
|
$str .= '<li>Facturation '.strtolower(Producer::$billingFrequencyArray[$producer->option_billing_frequency]).'</li>'; |
|
|
|
} |
|
|
|
$str .= '</ul>'; |
|
|
|
|
|
|
|
if($producer->option_billing_permanent_transfer) { |
|
|
|
$str .= '<li>Virement permanent : <strong>'.Price::format($producer->option_billing_permanent_transfer_amount).'</strong></li>'; |
|
|
|
return $str; |
|
|
|
} |
|
|
|
], |
|
|
|
[ |
|
|
|
'attribute' => 'admin_comment', |
|
|
|
'label' => 'Commentaire', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($producer) { |
|
|
|
if($producer->admin_comment) { |
|
|
|
return $producer->admin_comment; |
|
|
|
} |
|
|
|
|
|
|
|
$str .= '</ul>'; |
|
|
|
|
|
|
|
return $str; |
|
|
|
} |
|
|
|
], |
|
|
|
[ |
|
|
|
'attribute' => 'admin_comment', |
|
|
|
'label' => 'Commentaire', |
|
|
|
'format' => 'raw', |
|
|
|
'value' => function($producer) { |
|
|
|
if($producer->admin_comment) { |
|
|
|
return $producer->admin_comment; |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
return ''; |
|
|
|
} |
|
|
|
], |
|
|
|
[ |
|
|
|
'class' => 'yii\grid\ActionColumn', |
|
|
|
'template' => '{update} {dolibarr} {billing} {alwaysdata}', |
|
|
|
'headerOptions' => ['class' => 'column-actions'], |
|
|
|
'contentOptions' => ['class' => 'column-actions'], |
|
|
|
'buttons' => [ |
|
|
|
'update' => function ($url, $model) { |
|
|
|
return Html::a( |
|
|
|
'<span class="glyphicon glyphicon-pencil"></span>', |
|
|
|
$url, |
|
|
|
[ |
|
|
|
'title' => 'Modifier', |
|
|
|
'class' => 'btn btn-default' |
|
|
|
] |
|
|
|
); |
|
|
|
}, |
|
|
|
'dolibarr' => function ($url, $model) { |
|
|
|
return Html::a( |
|
|
|
'<span class="glyphicon glyphicon-paste"></span>', |
|
|
|
$url, |
|
|
|
[ |
|
|
|
'title' => 'Générer la facture sur Dolibarr', |
|
|
|
'class' => 'btn btn-default' |
|
|
|
] |
|
|
|
); |
|
|
|
}, |
|
|
|
'billing' => function ($url, $model) { |
|
|
|
return Html::a( |
|
|
|
'<span class="glyphicon glyphicon-euro"></span>', |
|
|
|
$url, |
|
|
|
[ |
|
|
|
'title' => 'Facturation', |
|
|
|
'class' => 'btn btn-default' |
|
|
|
] |
|
|
|
); |
|
|
|
}, |
|
|
|
'alwaysdata' => function ($url, $model) { |
|
|
|
return Html::a( |
|
|
|
'<span class="glyphicon glyphicon-road"></span>', |
|
|
|
$url, |
|
|
|
[ |
|
|
|
'title' => 'Redirections Alwaysdata (email et url courte)', |
|
|
|
'class' => 'btn btn-default' |
|
|
|
] |
|
|
|
); |
|
|
|
}, |
|
|
|
], |
|
|
|
[ |
|
|
|
'class' => 'yii\grid\ActionColumn', |
|
|
|
'template' => '{update} {billing} {dolibarr} {alwaysdata}', |
|
|
|
'headerOptions' => ['class' => 'column-actions'], |
|
|
|
'contentOptions' => ['class' => 'column-actions'], |
|
|
|
'buttons' => [ |
|
|
|
'update' => function ($url, $model) { |
|
|
|
return Html::a( |
|
|
|
'<span class="glyphicon glyphicon-pencil"></span>', |
|
|
|
$url, |
|
|
|
[ |
|
|
|
'title' => 'Modifier', |
|
|
|
'class' => 'btn btn-default' |
|
|
|
] |
|
|
|
); |
|
|
|
}, |
|
|
|
'dolibarr' => function ($url, $model) { |
|
|
|
return Html::a( |
|
|
|
'<span class="glyphicon glyphicon-paste"></span>', |
|
|
|
$url, |
|
|
|
[ |
|
|
|
'title' => 'Générer la facture sur Dolibarr', |
|
|
|
'class' => 'btn btn-default btn-dolibarr' |
|
|
|
] |
|
|
|
); |
|
|
|
}, |
|
|
|
'billing' => function ($url, $model) { |
|
|
|
return Html::a( |
|
|
|
'<span class="glyphicon glyphicon-euro"></span>', |
|
|
|
$url, |
|
|
|
[ |
|
|
|
'title' => 'Facturation', |
|
|
|
'class' => 'btn btn-default' |
|
|
|
] |
|
|
|
); |
|
|
|
}, |
|
|
|
'alwaysdata' => function ($url, $model) { |
|
|
|
return Html::a( |
|
|
|
'<span class="glyphicon glyphicon-road"></span>', |
|
|
|
$url, |
|
|
|
[ |
|
|
|
'title' => 'Redirections Alwaysdata (email et url courte)', |
|
|
|
'class' => 'btn btn-default btn-alwaysdata' |
|
|
|
] |
|
|
|
); |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
], |
|
|
|
]); ?> |
|
|
|
]); ?> |
|
|
|
|
|
|
|
</div> |