Refactor VisaMasterPaymentOrder resource: removed infolist method, updated header actions in edit and view pages, and improved infolist styling.

This commit is contained in:
2025-11-13 21:17:20 +05:00
parent 294ec0144d
commit 816a6c2f60
9 changed files with 84 additions and 18 deletions

View File

@@ -16,7 +16,7 @@ class EditVisaMasterPaymentOrder extends EditRecord
protected function getHeaderActions(): array
{
return [
ViewAction::make(),
// ViewAction::make(),
DeleteAction::make(),
ForceDeleteAction::make(),
RestoreAction::make(),

View File

@@ -5,6 +5,7 @@ namespace App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOr
use App\Filament\Clusters\VisaMasterPayments\Resources\VisaMasterPaymentOrders\VisaMasterPaymentOrderResource;
use Filament\Actions\EditAction;
use Filament\Resources\Pages\ViewRecord;
use Filament\Support\Icons\Heroicon;
class ViewVisaMasterPaymentOrder extends ViewRecord
{
@@ -13,7 +14,8 @@ class ViewVisaMasterPaymentOrder extends ViewRecord
protected function getHeaderActions(): array
{
return [
EditAction::make(),
EditAction::make()
->icon(Heroicon::OutlinedPencil),
];
}
}

View File

@@ -7,6 +7,7 @@ use App\Modules\Region\Repositories\RegionRepository;
use App\Modules\TurkmenPassport\Repositories\TurkmenPassportRepository;
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder;
use Filament\Infolists\Components\IconEntry;
use Illuminate\Support\Str;
use Filament\Infolists\Components\SpatieMediaLibraryImageEntry;
use Filament\Infolists\Components\TextEntry;
use Filament\Schemas\Components\Fieldset;
@@ -14,6 +15,8 @@ use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Schemas\Schema;
use Filament\Support\Enums\IconSize;
use Filament\Support\Enums\TextSize;
use Filament\Support\Icons\Heroicon;
class VisaMasterPaymentOrderInfolist
@@ -22,23 +25,20 @@ class VisaMasterPaymentOrderInfolist
{
return $schema
->components([
Section::make(__('Order details'))
Section::make()
->columnSpanFull()
->columns(4)
->columns(3)
->components([
TextEntry::make('type')
->label(__('Payment type'))
->formatStateUsing(fn ($state) => VisaMasterPaymentOrder::applicationTypes()[$state] ?? $state)
->inlineLabel(true)
->badge(),
->label(__('Payment type'))
->extraAttributes(['style' => 'text-transform:uppercase;font-size:1.5em;font-weight:bold;']),
TextEntry::make('status')
->label(__('Status'))
->formatStateUsing(fn ($state) => OrderStatusRepository::statusValues()[$state] ?? $state)
->badge()
->color(OrderStatusRepository::statusColorMatching())
->columnSpan(2),
->formatStateUsing(fn (string $state) => OrderStatusRepository::statusFormatted($state))
->extraAttributes(['style' => 'text-transform:uppercase;font-size:1.2em;font-weight:bold;'])
->color(OrderStatusRepository::statusColorMatching()),
IconEntry::make('paid')
->label(sprintf('%s (%s)', __('Paid'), __('This month')))

View File

@@ -67,7 +67,7 @@ class VisaMasterPaymentOrdersTable
TrashedFilter::make(),
])
->recordActions([
ViewAction::make(),
// ViewAction::make(),
EditAction::make(),
])
->toolbarActions([

View File

@@ -50,11 +50,6 @@ class VisaMasterPaymentOrderResource extends Resource
return VisaMasterPaymentOrderForm::configure($schema);
}
public static function infolist(Schema $schema): Schema
{
return VisaMasterPaymentOrderInfolist::configure($schema);
}
public static function table(Table $table): Table
{
return VisaMasterPaymentOrdersTable::configure($table);

View File

@@ -8,6 +8,7 @@ use App\Modules\BaseAuth\Middleware\RedirectIfUserPhoneIsUnVerfied;
use App\Modules\BaseLocale\Middleware\SetLocale;
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
use CraftForge\FilamentLanguageSwitcher\FilamentLanguageSwitcherPlugin;
use Filament\Enums\GlobalSearchPosition;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\AuthenticateSession;
use Filament\Http\Middleware\DisableBladeIconComponents;

View File

@@ -0,0 +1,56 @@
.filepond--pdf-preview-wrapper {
background: #00000003;
border-radius: 0.45em;
height: 100%;
left: 0;
margin: 0;
overflow: hidden;
position: absolute;
right: 0;
top: 0;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.filepond--pdf-preview {
align-items: center;
background: #222;
display: flex;
height: 100%;
left: 0;
/* pointer-events: none; */
position: absolute;
top: 0;
width: 100%;
will-change: transform, opacity;
z-index: 1;
}
.filepond--pdf-preview-iframe {
position: absolute;
left: 0;
right: 0;
margin: auto;
width: 100%;
padding-top: unset;
transform: scale(1.05);
}
.filepond--overlay-shadow {
background: linear-gradient(to bottom, #282828d9 0%, transparent 100%);
mix-blend-mode: multiply;
width: 100%;
height: 4rem;
position: absolute;
left: 0;
z-index: 2;
}
.filepond--overlay-shadow.overlay-shadow--success {
background: linear-gradient(to bottom, #369763 0%, transparent 100%);
}
.filepond--overlay-shadow.overlay-shadow--failure {
background: linear-gradient(to bottom, #c44e47 0%, transparent 100%);
}

View File

@@ -0,0 +1 @@
var u=r=>r.type==="application/pdf",y=r=>new URLSearchParams({toolbar:r.query("GET_PDF_TOOLBAR")?1:0,navpanes:r.query("GET_PDF_NAVPANE")?1:0,statusbar:r.query("GET_PDF_STATUS_BAR")?1:0,zoom:r.query("GET_PDF_ZOOM")?1:0,view:r.query("GET_PDF_VIEW"),scrollbar:r.query("GET_PDF_SCROLLBAR")?1:0,page:r.query("GET_PDF_DISPLAY_PAGE")}),I=r=>{let a=({root:e,props:n})=>{let{id:c}=n,t=e.query("GET_ITEM",c),p=y(e),d=()=>{if(typeof t.source!="string"){let i=window.URL||window.webkitURL,l=new Blob([t.file],{type:t.file.type});return i.createObjectURL(l)}return t.source};e.ref.pdf.src=`${d()}#${p.toString()}`,e.ref.pdf.addEventListener("load",()=>{e.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:c,height:e.ref.pdf.scrollHeight})},!1)},s=({root:e,props:n})=>{e.query("GET_ITEM",n.id).file&&(e.ref.pdf=document.createElement("iframe"),e.ref.pdf.setAttribute("height",e.query("GET_PDF_PREVIEW_HEIGHT")||320),e.ref.pdf.classList.add("filepond--pdf-preview-iframe"),e.element.appendChild(e.ref.pdf))};return r.createView({name:"pdf-preview",tag:"div",create:s,write:r.createRoute({DID_PDF_PREVIEW_LOAD:a})})},T=r=>r.createView({name:"overlay-shadow",tag:"div",ignoreRect:!0,create:({root:a,props:s})=>{a.element.classList.add(`overlay-shadow--${s.status}`)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}}),D=r=>{let a=r.utils,s=I(a),e=T(a),n=({root:i,props:l})=>{let{id:f}=l;i.dispatch("DID_PDF_PREVIEW_LOAD",{id:f})},c=({root:i,props:l})=>{i.ref.overlayShadow=i.appendChildView(i.createChildView(e,{opacity:1,status:"idle"})),i.ref.overlaySuccess=i.appendChildView(i.createChildView(e,{opacity:0,status:"success"})),i.ref.overlayError=i.appendChildView(i.createChildView(e,{opacity:0,status:"failure"})),i.ref.pdf=i.appendChildView(i.createChildView(s,{id:l.id}))},t=({root:i})=>{i.ref.overlayShadow.opacity=1,i.ref.overlayError.opacity=0,i.ref.overlaySuccess.opacity=0},p=({root:i,props:l})=>{i.ref.overlayShadow.opacity=.1,i.ref.overlayError.opacity=1},d=({root:i,props:l})=>{i.ref.overlayShadow.opacity=.1,i.ref.overlaySuccess.opacity=1};return a.createView({name:"pdf-preview-wrapper",tag:"div",create:c,write:a.createRoute({DID_CREATE_PDF_PREVIEW_CONTAINER_VIEW:n,DID_THROW_ITEM_LOAD_ERROR:p,DID_THROW_ITEM_PROCESSING_ERROR:p,DID_THROW_ITEM_INVALID:p,DID_COMPLETE_ITEM_PROCESSING:d,DID_START_ITEM_PROCESSING:t,DID_REVERT_ITEM_PROCESSING:t})})},v=r=>{let{addFilter:a,utils:s}=r,{Type:e,createRoute:n}=s,c=D(r);return a("CREATE_VIEW",t=>{let{is:p,view:d,query:i}=t;if(!p("file"))return;let l=({root:f,props:w})=>{let{id:E}=w,_=i("GET_ITEM",E),o=i("GET_ALLOW_PDF_PREVIEW");!_||!u(_?.file)||_?.archived||!o||(f.ref.pdfPreview=d.appendChildView(d.createChildView(c,{id:E})),f.dispatch("DID_CREATE_PDF_PREVIEW_CONTAINER_VIEW",{id:E}))};d.registerWriter(n({DID_LOAD_ITEM:l}),(f,w)=>{f.ref.pdfPreview&&f.rect.element.hidden})}),{options:{allowPdfPreview:[!0,e.BOOLEAN],pdfPreviewHeight:[400,e.INT],pdfToolbar:[!1,e.BOOLEAN],pdfNavPanes:[!1,e.BOOLEAN],pdfStatusBar:[!1,e.BOOLEAN],pdfZoom:[!1,e.BOOLEAN],pdfView:["fitW",e.STRING],pdfDisplayPage:[1,e.INT]}}},P=v;function R({pdfPreviewHeight:r,pdfScrollbar:a,pdfDisplayPage:s,pdfToolbar:e,pdfNavPanes:n,pdfZoom:c,pdfView:t,allowPdfPreview:p}){document.addEventListener("FilePond:loaded",function(){let d=window.FilePond;d.registerPlugin(P),d.setOptions({pdfPreviewHeight:r,pdfScrollbar:a,pdfDisplayPage:s,pdfToolbar:e,pdfNavPanes:n,pdfZoom:c,pdfView:t,allowPdfPreview:p})})}export{R as default};

View File

@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<g class="nc-icon-wrapper">
<rect x="2" y="7" width="28" height="18" rx="3" ry="3" fill="#1434cb" stroke-width="0"></rect>
<path d="m27,7H5c-1.657,0-3,1.343-3,3v12c0,1.657,1.343,3,3,3h22c1.657,0,3-1.343,3-3v-12c0-1.657-1.343-3-3-3Zm2,15c0,1.103-.897,2-2,2H5c-1.103,0-2-.897-2-2v-12c0-1.103.897-2,2-2h22c1.103,0,2,.897,2,2v12Z" stroke-width="0" opacity=".15"></path>
<path d="m27,8H5c-1.105,0-2,.895-2,2v1c0-1.105.895-2,2-2h22c1.105,0,2,.895,2,2v-1c0-1.105-.895-2-2-2Z" fill="#fff" opacity=".2" stroke-width="0"></path>
<path d="m13.392,12.624l-2.838,6.77h-1.851l-1.397-5.403c-.085-.332-.158-.454-.416-.595-.421-.229-1.117-.443-1.728-.576l.041-.196h2.98c.38,0,.721.253.808.69l.738,3.918,1.822-4.608h1.84Z" fill="#fff" stroke-width="0"></path>
<path d="m20.646,17.183c.008-1.787-2.47-1.886-2.453-2.684.005-.243.237-.501.743-.567.251-.032.943-.058,1.727.303l.307-1.436c-.421-.152-.964-.299-1.638-.299-1.732,0-2.95.92-2.959,2.238-.011.975.87,1.518,1.533,1.843.683.332.912.545.909.841-.005.454-.545.655-1.047.663-.881.014-1.392-.238-1.799-.428l-.318,1.484c.41.188,1.165.351,1.947.359,1.841,0,3.044-.909,3.05-2.317" fill="#fff" stroke-width="0"></path>
<path d="m25.423,12.624h-1.494c-.337,0-.62.195-.746.496l-2.628,6.274h1.839l.365-1.011h2.247l.212,1.011h1.62l-1.415-6.77Zm-2.16,4.372l.922-2.542.53,2.542h-1.452Z" fill="#fff" stroke-width="0"></path>
<path fill="#fff" stroke-width="0" d="M15.894 12.624L14.446 19.394 12.695 19.394 14.143 12.624 15.894 12.624z"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB