import { SaleInvoiceSingleInfoCardComponent } from '@/shared/components/invoices/sale-invoice-single-info-card.component'; import pageParamsUtils from '@/utils/page-params.utils'; import { Component, computed, inject, signal } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { ButtonDirective } from 'primeng/button'; import { Card } from 'primeng/card'; import { PublicSaleInvoiceStore } from '../store/main.store'; @Component({ selector: 'public-saleInvoice', templateUrl: './single.component.html', imports: [SaleInvoiceSingleInfoCardComponent, Card, ButtonDirective], }) export class PublicSaleInvoiceComponent { private readonly route = inject(ActivatedRoute); private readonly store = inject(PublicSaleInvoiceStore); pageParams = computed(() => pageParamsUtils(this.route)); invoiceId = signal(this.pageParams()['invoiceId']); readonly invoice = computed(() => this.store.entity()); readonly loading = computed(() => this.store.loading()); ngOnInit() { this.store.getData(this.invoiceId()); } async share() { if (navigator.share) { await navigator.share({ title: window.document.title, text: 'برای مشاهده صورت‌حساب اینجا کلیک کنید.', url: window.location.href, }); } } }