-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FRW-9176 Introduced View page for merchants in the BackOffice. (#11133)
FRW-9176 Introduced View page for merchants in the BackOffice.
- Loading branch information
1 parent
f78798f
commit 33d07ac
Showing
18 changed files
with
600 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
src/Spryker/Zed/MerchantGui/Communication/Controller/ViewMerchantController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\MerchantGui\Communication\Controller; | ||
|
||
use Generated\Shared\Transfer\MerchantCriteriaTransfer; | ||
use Spryker\Zed\Kernel\Communication\Controller\AbstractController; | ||
use Spryker\Zed\MerchantGui\MerchantGuiConfig; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
/** | ||
* @method \Spryker\Zed\MerchantGui\Communication\MerchantGuiCommunicationFactory getFactory() | ||
*/ | ||
class ViewMerchantController extends AbstractController | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected const REQUEST_ID_MERCHANT = 'id-merchant'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const MESSAGE_MERCHANT_NOT_FOUND = 'Merchant with id `%d` doesn\'t exist.'; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected const ID_MERCHANT_PLACEHOLDER = '%d'; | ||
|
||
/** | ||
* @param \Symfony\Component\HttpFoundation\Request $request | ||
* | ||
* @return mixed | ||
*/ | ||
public function indexAction(Request $request) | ||
{ | ||
$idMerchant = $this->castId($request->get( | ||
static::REQUEST_ID_MERCHANT, | ||
)); | ||
|
||
$merchantCriteriaTransfer = new MerchantCriteriaTransfer(); | ||
$merchantCriteriaTransfer->setIdMerchant($idMerchant); | ||
$merchantTransfer = $this->getFactory()->getMerchantFacade()->findOne($merchantCriteriaTransfer); | ||
|
||
if ($merchantTransfer === null) { | ||
$this->addErrorMessage(static::MESSAGE_MERCHANT_NOT_FOUND, [static::ID_MERCHANT_PLACEHOLDER => $idMerchant]); | ||
|
||
return $this->redirectResponse(MerchantGuiConfig::URL_MERCHANT_LIST); | ||
} | ||
|
||
return $this->viewResponse([ | ||
'idMerchant' => $idMerchant, | ||
'merchant' => $merchantTransfer, | ||
'merchantProfile' => $merchantTransfer->getMerchantProfile(), | ||
'storeRelations' => $merchantTransfer->getStoreRelation() ? $merchantTransfer->getStoreRelation()->getStores() : [], | ||
'merchantUrlCollection' => $merchantTransfer->getUrlCollection(), | ||
'merchantStockCollection' => $merchantTransfer->getStocks(), | ||
'merchantAddressCollection' => $merchantTransfer->getMerchantProfile() ? $merchantTransfer->getMerchantProfile()->getAddressCollection() : [], | ||
'merchantLocalizedAttributes' => $merchantTransfer->getMerchantProfile() ? $merchantTransfer->getMerchantProfile()->getMerchantProfileLocalizedGlossaryAttributes() : [], | ||
'toggleActiveForm' => $this->getFactory()->createToggleActiveMerchantForm()->createView(), | ||
'toggleStatusForm' => $this->getFactory()->createMerchantStatusForm()->createView(), | ||
'merchantUserTable' => $this->getFactory()->createMerchantViewForm($merchantTransfer)->createView()->vars['tables']['merchantUsersTable'], | ||
]); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Spryker/Zed/MerchantGui/Communication/Form/MerchantViewForm.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\MerchantGui\Communication\Form; | ||
|
||
use Spryker\Zed\Kernel\Communication\Form\AbstractType; | ||
use Symfony\Component\Form\FormInterface; | ||
use Symfony\Component\Form\FormView; | ||
|
||
/** | ||
* @method \Spryker\Zed\MerchantGui\Communication\MerchantGuiCommunicationFactory getFactory() | ||
* @method \Spryker\Zed\MerchantGui\MerchantGuiConfig getConfig() | ||
*/ | ||
class MerchantViewForm extends AbstractType | ||
{ | ||
/** | ||
* @param \Symfony\Component\Form\FormView $view | ||
* @param \Symfony\Component\Form\FormInterface $form | ||
* @param array<string, mixed> $options | ||
* | ||
* @return void | ||
*/ | ||
public function buildView(FormView $view, FormInterface $form, array $options): void | ||
{ | ||
foreach ($this->getFactory()->getMerchantViewFormViewExpanderPlugins() as $formViewExpanderPlugin) { | ||
$view = $formViewExpanderPlugin->expand($view, $form, $options); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/Spryker/Zed/MerchantGui/Presentation/ViewMerchant/_partials/activate-button.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% if merchant.isActive %} | ||
{% set actionUrl = url('/merchant-gui/edit-merchant/deactivate', { 'id-merchant': merchant.idMerchant }) %} | ||
{% set label = 'Deactivate' | trans %} | ||
{% set buttonClass = 'btn-remove' %} | ||
{% set icon = 'fa-trash' %} | ||
{% else %} | ||
{% set actionUrl = url('/merchant-gui/edit-merchant/activate', { 'id-merchant': merchant.idMerchant }) %} | ||
{% set label = 'Activate' | trans %} | ||
{% set buttonClass = 'btn-view' %} | ||
{% set icon = 'fa-caret-right' %} | ||
{% endif %} | ||
|
||
{{ form_start(toggleActiveForm, { | ||
action: actionUrl, | ||
attr: { class: 'form-inline' } | ||
}) }} | ||
|
||
<button class="btn btn-sm btn-outline safe-submit {{ buttonClass }}"> | ||
<i class="fa {{ icon }}"></i> {{ label }} | ||
</button> | ||
|
||
{{ form_end(toggleActiveForm) }} |
33 changes: 33 additions & 0 deletions
33
src/Spryker/Zed/MerchantGui/Presentation/ViewMerchant/_partials/info-contact-person.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% embed '@Gui/Partials/widget.twig' with { widget_title: 'Contact Person' | trans } %} | ||
{% block widget_content %} | ||
<div class="row"> | ||
<div class="col-xs-2"><b>{{ 'Role' | trans }}</b></div> | ||
<div class="col-xs-10">{{ merchantProfile.contactPersonRole }}</div> | ||
</div> | ||
<div class="hr-line-dashed"></div> | ||
|
||
<div class="row"> | ||
<div class="col-xs-2"><b>{{ 'Title' | trans }}</b></div> | ||
<div class="col-xs-10">{{ merchantProfile.contactPersonTitle }}</div> | ||
</div> | ||
<div class="hr-line-dashed"></div> | ||
|
||
<div class="row"> | ||
<div class="col-xs-2"><b>{{ 'First Name' | trans }}</b></div> | ||
<div class="col-xs-10">{{ merchantProfile.contactPersonFirstName }}</div> | ||
</div> | ||
<div class="hr-line-dashed"></div> | ||
|
||
<div class="row"> | ||
<div class="col-xs-2"><b>{{ 'Last Name' | trans }}</b></div> | ||
<div class="col-xs-10">{{ merchantProfile.contactPersonLastName }}</div> | ||
</div> | ||
<div class="hr-line-dashed"></div> | ||
|
||
<div class="row"> | ||
<div class="col-xs-2"><b>{{ 'Phone' | trans }}</b></div> | ||
<div class="col-xs-10">{{ merchantProfile.contactPersonPhone }}</div> | ||
</div> | ||
<div class="hr-line-dashed"></div> | ||
{% endblock %} | ||
{% endembed %} |
Oops, something went wrong.