Skip to content

Commit

Permalink
Add payment detail page
Browse files Browse the repository at this point in the history
Detail page of one payment which can be shared
when communicating with helpdesk / other admins.

URL: `/payments/payments-admin/show/{PAYMENT-ID}`

Link to detail of payment was added:

- To all payments list.
- To the list of user's payments.
- To the list of user's subscriptions (there was payment ID; it's a link now).
- To the detail of one subscription (only link to payment; added as
  widget).

It contains three SimpleWidget placeholders through which you can
extend this screen as needed:

- admin.payments.show.left
- admin.payments.show.right
- admin.payments.show.bottom

remp/crm#2487
  • Loading branch information
markoph committed Sep 26, 2023
1 parent 92bc3f0 commit ac0c6c6
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{if $showButton}
{if $admin}
<a href="{plink :Invoices:ReceiptsAdmin:downloadReceipt $paymentId}" class="btn btn-sm btn-primary">
<i class="fa fa-download"></i> {_invoices.frontend.download_receipt}
</a>
<li class="menuitem-header">{_invoices.frontend.download_receipt.header}</li>
<li role="menuitem">
<a href="{plink :Invoices:ReceiptsAdmin:downloadReceipt $paymentId}">
<i class="fa fa-download"></i> {_invoices.frontend.download_receipt.download}
</a>
</li>
{else}
<a href="{plink ':Invoices:Receipts:downloadReceipt' $paymentId}" class="btn btn-sm btn-primary">
<i class="fa fa-download"></i> {_invoices.frontend.download_receipt}
<i class="fa fa-download"></i> {_invoices.frontend.download_receipt.download}
</a>
{/if}
{/if}
{/if}
49 changes: 32 additions & 17 deletions src/Components/InvoiceButton/invoice_button.latte
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
{if $admin}
<li class="menuitem-header">{_invoices.frontend.invoice_button.header}</li>
{if $payment->invoice}
<div class="btn-group" style="margin-bottom: 2px">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
<i class="fas fa-file-invoice"></i>
{_invoices.frontend.invoice_button.invoice} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="{plink :Invoices:InvoicesAdmin:downloadInvoice $payment->id}"><i class="fa fa-download"></i> {_invoices.frontend.invoice_button.download}</a></li>
<li><a href="{plink :Invoices:InvoicesAdmin:edit $payment->invoice->id}"><i class="fa fa-edit"></i> {_invoices.frontend.invoice_button.edit}</a></li>
</ul>
</div>
<li>
<a href="{plink :Invoices:InvoicesAdmin:downloadInvoice $payment->id}">
<i class="fa fa-download"></i> {_invoices.frontend.invoice_button.download}
</a>
</li>
<li>
<a href="{plink :Invoices:InvoicesAdmin:edit $payment->invoice->id}">
<i class="fa fa-edit"></i> {_invoices.frontend.invoice_button.edit}
</a>
</li>
{elseif $paymentInvoicable}
{var $invoiceAddress = $payment->user->related('addresses')->where('deleted_at IS NULL')->where(['type' => 'invoice'])->limit(1)->fetch()}
{if $invoiceAddress}
<a href="{plink :Invoices:InvoicesAdmin:downloadInvoice $payment->id}" target="_bank" class="btn btn-primary btn-sm"><i class="fa fa-magic"></i> {_invoices.frontend.invoice_button.generate}</a>
<li>
<a href="{plink :Invoices:InvoicesAdmin:downloadInvoice $payment->id}" target="_bank">
<i class="fa fa-magic"></i> {_invoices.frontend.invoice_button.generate}
</a>
</li>
{else}
<a href="{plink :Users:AddressAdmin:new userId => $payment->user->id}" class="btn btn-primary btn-sm"><i class="fa fa-star-half-stroke"></i> {_invoices.frontend.invoice_button.invoice_details}</a>
<li>
<a href="{plink :Users:AddressAdmin:new userId => $payment->user->id}">
<i class="fa fa-star-half-stroke"></i> {_invoices.frontend.invoice_button.invoice_details}
</a>
</li>
{/if}
{elseif $paidButNotInvoiceableAnymore}
<span class="btn btn-sm btn-default disabled">
<i class="fa fa-ban"></i> {_invoices.frontend.invoice_button.not_available_anymore}
</span>
<li>
<a class="disabled">
<i class="fa fa-ban"></i> {_invoices.frontend.invoice_button.not_available_anymore}
</a>
</li>
{else}
<span class="btn btn-sm btn-default disabled"><i class="fa fa-ban"></i> {_invoices.frontend.invoice_button.no_invoice}</span>
<li>
<a class="disabled">
<i class="fa fa-ban"></i> {_invoices.frontend.invoice_button.no_invoice}
</a>
</li>
{/if}

{else}
{if $payment->invoice}
<a target="_blank" class="btn btn-sm btn-primary" href="{plink :Invoices:Invoices:DownloadInvoice $payment->id}"><i class="fa fa-download"></i> {_invoices.frontend.invoice_button.download}</a>
Expand Down
4 changes: 2 additions & 2 deletions src/InvoicesModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function registerFrontendMenuItems(MenuContainerInterface $menuContainer)
public function registerLazyWidgets(LazyWidgetManagerInterface $widgetManager)
{
$widgetManager->registerWidgetFactory(
'admin.payments.listing.action',
'admin.payments.listing.action.menu',
\Crm\InvoicesModule\Components\InvoiceAdminButtonFactory::class,
400
);
Expand All @@ -63,7 +63,7 @@ public function registerLazyWidgets(LazyWidgetManagerInterface $widgetManager)
);

$widgetManager->registerWidgetFactory(
'admin.payments.listing.action',
'admin.payments.listing.action.menu',
\Crm\InvoicesModule\Components\ReceiptAdminButtonFactory::class,
500
);
Expand Down
5 changes: 4 additions & 1 deletion src/lang/invoices.cs_CZ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ menu:

frontend:
invoice_button:
header: Faktura
no_invoice: Bez faktury
not_available_anymore: Faktura již nedostupná
generate: Vygeneruj fakturu
Expand Down Expand Up @@ -58,7 +59,9 @@ frontend:
foreign_country: "Pro informace o doručení do zahraničí nás prosím kontaktujte na %contactEmail%"
success: Vaše adresa byla úspěšně změněna.
warning: "Fakturu si můžete vygenerovat pouze do 14 dní od zaplacení. Pro vygenerování faktur <a href='%link%' style='text-decoration: underline;'>klikněte sem</a>."
download_receipt: Stáhnout potvrzení
download_receipt:
header: Potvrzení
download: Stáhnout potvrzení
proforma_invoice:
title: Platba předfakturou
form_title: 'Pro dokončení objednávky prosím vyplňte fakturační údaje'
Expand Down
3 changes: 2 additions & 1 deletion src/lang/invoices.de_DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ frontend:
title: Zahlung per Vorkasse
form_title: Bitte füllen Sie die Rechnungsdaten aus, um die Bestellung abzuschließen
thank_you: Vielen Dank für Ihre Bestellung, die Rechnung wird Ihnen innerhalb von 3 Werktagen per E-Mail zugestellt.
download_receipt: Rechnungsbeleg herunterladen
download_receipt:
download: Rechnungsbeleg herunterladen
admin:
default:
export: Rechnungsexport
Expand Down
5 changes: 4 additions & 1 deletion src/lang/invoices.en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ menu:

frontend:
invoice_button:
header: Invoice
no_invoice: No invoice
not_available_anymore: Invoice not available anymore
generate: Generate invoice
Expand Down Expand Up @@ -59,7 +60,9 @@ frontend:
foreign_country: "For delivery to foreign countries please contact us through %contactEmail%"
success: Your address was successfuly changed.
warning: "You can generate an invoice only within 14 days of payment. You can generate invoices <a href='%link%' style='text-decoration: underline;'>here</a>."
download_receipt: Download receipt
download_receipt:
header: Receipt
download: Download receipt
proforma_invoice:
title: Proforma invoice payment
form_title: 'Please fill up your invoice details to complete the order'
Expand Down
3 changes: 2 additions & 1 deletion src/lang/invoices.hu_HU.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ frontend:
required: "Meg kell adni az IČDPH-t (áfás adószámot)"
success: "Sikeres címváltoztatás."
warning: "A számlát csak a kifizetés utáni 14 napon belül hozhatja létre. A számla létrehozásához <a href='%link%' style='text-decoration: underline;'>kattintson ide</a>."
download_receipt: Igazolás letöltése
download_receipt:
download: Igazolás letöltése
proforma_invoice:
title: Fizetés előlegszámlával
form_title: 'A megrendelés véglegesítéséhez, kérjük, töltse ki a számlázási adatokat'
Expand Down
5 changes: 4 additions & 1 deletion src/lang/invoices.sk_SK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ menu:

frontend:
invoice_button:
header: Faktúra
no_invoice: Bez faktúry
not_available_anymore: Faktúra už nedostupná
generate: Vygeneruj faktúru
Expand Down Expand Up @@ -59,7 +60,9 @@ frontend:
foreign_country: "Pre informácie o doručení do zahraničia nás, prosím, kontaktujte na %contactEmail%"
success: Vaša adresa bola úspešne zmenená.
warning: "Faktúru si môžete vygenerovať len do 14 dní po zaplatení. Pre vygenerovanie faktúr <a href='%link%' style='text-decoration: underline;'>kliknite sem</a>."
download_receipt: Stiahnuť potvrdenie
download_receipt:
header: Potvrdenie
download: Stiahnuť potvrdenie
proforma_invoice:
title: Platba predfaktúrou
form_title: 'Pre dokončenie objednávky prosím vyplňte fakturačné údaje'
Expand Down

0 comments on commit ac0c6c6

Please sign in to comment.