@@ -67,7 +67,9 @@ class OrderAdminController extends BackendController | |||
public function actionIndex() | |||
{ | |||
$searchModel = new OrderSearch(); | |||
$dataProvider = $searchModel->search(array_merge(\Yii::$app->request->queryParams)); | |||
$dataProvider = $searchModel->search([ | |||
'order_by' => 'IF(ISNULL(date_update), `order`.`date`, `order`.`date_update`) DESC' | |||
]); | |||
return $this->render('index', [ | |||
'searchModel' => $searchModel, |
@@ -157,6 +157,12 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran | |||
'url' => ['order-admin/index'], | |||
'visible' => $isUserCurrentGrantedAsAdministrator, | |||
], | |||
[ | |||
'label' => 'Fonctionnalités', | |||
'icon' => 'flag', | |||
'url' => ['/feature-admin/index'], | |||
'visible' => $isUserCurrentGrantedAsAdministrator | |||
], | |||
[ | |||
'label' => 'Statistiques', | |||
'icon' => 'line-chart', | |||
@@ -182,7 +188,6 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran | |||
'visible' => $isUserCurrentGrantedAsAdministrator, | |||
'items' => [ | |||
['label' => 'Paramètres', 'icon' => 'cog', 'url' => ['/setting-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator && $featureChecker->isEnabled(Feature::ALIAS_SETTINGS)], | |||
['label' => 'Fonctionnalités', 'icon' => 'flag', 'url' => ['/feature-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator], | |||
['label' => 'Tranches de prix', 'icon' => 'eur', 'url' => ['/producer-price-range-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator], | |||
['label' => 'Taxes', 'icon' => 'eur', 'url' => ['/tax-rate-admin/index'], 'visible' => $isUserCurrentGrantedAsAdministrator], | |||
], |
@@ -71,10 +71,11 @@ $this->addBreadcrumb('Commandes') ; | |||
} | |||
], | |||
[ | |||
'label' => 'Origine', | |||
'label' => 'Utilisateur', | |||
'format' => 'raw', | |||
'value' => function ($order) use ($orderModule) { | |||
return $orderModule->getSolver()->getLabelOrigin($order, true);; | |||
return $orderModule->getSolver()->getOrderUsername($order) | |||
.'<br />'.$orderModule->getSolver()->getLabelOrigin($order, true); | |||
} | |||
], | |||
[ |
@@ -57,6 +57,7 @@ use yii\widgets\ActiveForm; | |||
<?= $form->field($model, 'slug') ?> | |||
<?= $form->field($model, 'name') ?> | |||
<?= $form->field($model, 'type')->textInput(['placeholder' => 'Boulangerie, brasserie, ferme ...']); ?> | |||
<?= $form->field($model, 'address')->textarea(['rows' => 4]) ?> | |||
<?= $form->field($model, 'postcode') ?> | |||
<?= $form->field($model, 'city') ?> | |||
<?= $form->field($model, 'contact_email') ?> | |||
@@ -70,6 +71,47 @@ use yii\widgets\ActiveForm; | |||
</div> | |||
</div> | |||
<div class="col-md-6"> | |||
<div class="panel panel-default"> | |||
<div class="panel-heading"> | |||
<h3 class="panel-title"> | |||
<i class="fa fa-copy"></i> | |||
Données à copier | |||
</h3> | |||
</div> | |||
<div class="panel-body"> | |||
<ul class="list-group list-group-unbordered"> | |||
<li class="list-group-item"> | |||
<strong>Email</strong> | |||
<span class="pull-right"> | |||
<a class="btn btn-xs btn-default" href="mailto:<?= $model->contact_email ?>"> | |||
<span class="glyphicon glyphicon-send"></span> | |||
</a> | |||
<a class="btn btn-xs btn-default clipboard-paste" data-clipboard-paste="<?= $model->contact_email ?>"> | |||
<span class="glyphicon glyphicon-copy"></span> | |||
</a> | |||
</span> | |||
</li> | |||
<li class="list-group-item"> | |||
<strong>Url courte boutique</strong> | |||
<span class="pull-right"> | |||
<a class="btn btn-xs btn-default clipboard-paste" data-clipboard-paste="<?= $model->getShortShopUrl() ?>"> | |||
<span class="glyphicon glyphicon-copy"></span> | |||
</a> | |||
</span> | |||
</li> | |||
<li class="list-group-item"> | |||
<strong>Url connexion / inscription</strong> | |||
<span class="pull-right"> | |||
<a class="btn btn-xs btn-default clipboard-paste" data-clipboard-paste="<?= $model->getLoginSignupUrl() ?>"> | |||
<span class="glyphicon glyphicon-copy"></span> | |||
</a> | |||
</span> | |||
</li> | |||
</ul> | |||
</div> | |||
</div> | |||
<div class="panel panel-default"> | |||
<div class="panel-heading"> | |||
<h3 class="panel-title"> |
@@ -60,6 +60,7 @@ $(document).ready(function () { | |||
opendistrib_dashboard_admin_statistics(); | |||
opendistrib_tinymce_responsive(); | |||
opendistrib_sponsorship(); | |||
opendistrib_clipboard_paste(); | |||
}); | |||
@@ -74,6 +75,15 @@ function label_unit_reference(unit) { | |||
return 'litre(s)'; | |||
} | |||
} | |||
function opendistrib_clipboard_paste() { | |||
$('.clipboard-paste').click(function() { | |||
navigator.clipboard.writeText($(this).attr('data-clipboard-paste')); | |||
appAlerts.alert('success', 'Copié dans le presse-papier'); | |||
return false; | |||
}); | |||
} | |||
function opendistrib_sponsorship() { | |||
$('#sponsorship-link-copy').click(function() { | |||
navigator.clipboard.writeText($(this).attr('href')); |
@@ -44,9 +44,6 @@ class OrderSearch extends Order | |||
{ | |||
public function search($params) | |||
{ | |||
$orderRepository = OrderRepository::getInstance(); | |||
$optionsSearch = $orderRepository->getDefaultOptionsSearch() ; | |||
$paramsSearch = []; | |||
if(isset($params['id_user'])) { | |||
$paramsSearch['id_user'] = $params['id_user']; | |||
@@ -54,7 +51,7 @@ class OrderSearch extends Order | |||
$query = Order::searchQuery($paramsSearch, [ | |||
'ignore_id_producer' => true, | |||
'orderby' => 'distribution.date DESC' | |||
'orderby' => isset($params['order_by']) ? $params['order_by'] : 'distribution.date DESC' | |||
]); | |||
$dataProvider = new ActiveDataProvider([ |
@@ -684,5 +684,15 @@ class Producer extends ActiveRecordCommon | |||
return false; | |||
} | |||
public function getShortShopUrl(): string | |||
{ | |||
return 'https://'.$this->slug.'.souke.fr'; | |||
} | |||
public function getLoginSignupUrl(): string | |||
{ | |||
return \Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/producer', 'id' => $this->id]); | |||
} | |||
} | |||
@@ -688,7 +688,8 @@ class OrderController extends ProducerBaseController | |||
'option_delivery' => $producer->option_delivery, | |||
'online_payment' => $producer->online_payment, | |||
'option_online_payment_type' => $producer->online_payment, | |||
'has_specific_delays' => $this->getProducerModule()->getSolver()->hasSpecificDelays($producer) | |||
'has_specific_delays' => $this->getProducerModule()->getSolver()->hasSpecificDelays($producer), | |||
'feature_product_accessory_enabled' => $this->getFeatureModule()->getChecker()->isEnabled(Feature::ALIAS_PRODUCT_ACCESSORY), | |||
]; | |||
} | |||
@@ -354,7 +354,7 @@ $this->setMeta('description', $producerModule->getSeoGenerator()->generateMetaDe | |||
<span v-if="product.weight">({{ product.weight }} g)</span> | |||
</span> | |||
<div> | |||
<span v-if="product.quantity_max != null && (product.quantity_remaining <= 0 || product.quantity_remaining * product.coefficient_unit < product.step)" | |||
<span v-if="product.quantity_max != null && (product.quantity_remaining <= 0 || product.quantity_remaining * product.coefficient_unit < product.step || product.quantity_form >= product.quantity_max * product.coefficient_unit)" | |||
class="badge bg-danger">Épuisé</span> | |||
</div> | |||
<div class="description" v-if="product.description.length"> |
@@ -151,7 +151,7 @@ var app = new Vue({ | |||
app.products = response.products; | |||
app.loadingProducts = false; | |||
}, 'json'); | |||
}.bind(this, app), 300); | |||
}.bind(this, app), 500); | |||
return; | |||
} | |||
@@ -531,7 +531,10 @@ var app = new Vue({ | |||
) { | |||
var theQuantity = parseFloat(this.products[product.index].quantity_form) + parseFloat(quantity); | |||
this.products[product.index].quantity_form = parseFloat(theQuantity.toFixed(2)) ; | |||
this.init('first', true); | |||
if(this.producer.feature_product_accessory_enabled) { | |||
this.init('first', true); | |||
} | |||
} | |||
}, | |||
oneProductOrdered: function() { |