Browse Source

[Administration] Producteurs admin : lien de connexion/inscription

feature/rotating_product
Guillaume Bourgeois 5 months ago
parent
commit
ce776916f5
3 changed files with 62 additions and 0 deletions
  1. +42
    -0
      backend/views/producer-admin/_form.php
  2. +10
    -0
      backend/web/js/backend.js
  3. +10
    -0
      domain/Producer/Producer/Producer.php

+ 42
- 0
backend/views/producer-admin/_form.php View File

@@ -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">

+ 10
- 0
backend/web/js/backend.js View File

@@ -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'));

+ 10
- 0
domain/Producer/Producer/Producer.php View File

@@ -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]);
}
}

Loading…
Cancel
Save