import{r as $,b as L,d as x,o as n,c as l,a as e,t as m,w as b,e as d,l as T,v as P,z as o,f as k,F as U,m as z,H as G,B as H,C as q}from"./app-91dba96b.js";import{i as J}from"./index-0653e21c.js";import{u as K}from"./useEmitter-cde057d4.js";import{u as Q}from"./useOpenModal-248d9645.js";import{u as R}from"./useDeleteModal-1f988578.js";import{n as W}from"./laravel-vue-pagination.es-47c433e6.js";import{u as h}from"./urlGenerator-87d92adb.js";import X from"./addSuraModal-0498a790.js";import{l as Y}from"./lodash-569b8a6d.js";import{_ as Z}from"./_plugin-vue_export-helper-c27b6911.js";import"./appFunction-1b5b1f43.js";import"./useSubmitForm-bd99a12d.js";import"./_commonjsHelpers-725317a4.js";const j=i=>(H("data-v-a9dcb3ff"),i=i(),q(),i),O={class:"content"},ee={class:"container-fluid p-0"},te={class:"mb-3"},se={class:"h3 d-inline align-middle"},oe={class:"search-container d-flex justify-content-end align-items-center"},ae={class:"row"},ne={class:"col-12"},le={class:"card"},ce={key:1,class:"table-responsive"},ie={class:"table mb-3"},re=j(()=>e("thead",null,[e("tr",null,[e("th",{scope:"col",style:{width:"45%"}},"Sura"),e("th",{scope:"col",style:{width:"20%"}},"Sura Number"),e("th",{scope:"col",style:{width:"20%"}},"Duration"),e("th",{scope:"col",style:{width:"20%"}},"View File"),e("th",{scope:"col",class:"text-end",style:{width:"15%"}},"Action")])],-1)),de={width:"30%"},ue={class:"d-flex align-items-center"},_e={class:"ms-3"},pe={class:"fw-bold"},me=["href"],he=["src"],ve={class:"table-action"},fe={class:"action-icons d-flex justify-content-end"},ge={key:0},ye=["onClick"],$e=["src"],be={key:1},ke=["onClick"],we=["src"],De={__name:"index",props:{reciter:Object},setup(i){const{isModalActive:v,selectedData:w,closeModal:S}=Q(),{deleteUrl:D,isDeleteModal:C,cancelled:M}=R(),u=i,f=$({}),g=$(!1),_=$(""),A=Y.debounce(()=>{_.value?r(1,_.value):r(1)},500),r=(t=1,a="")=>{g.value=!0,J.get(`reciter-sura-list/${u.reciter.id}?page=${t}&search=${a}`).then(c=>{f.value=c.data}).finally(()=>g.value=!1)},I=t=>{v.value=!0,w.value=`reciter-sura/${t.id}`},V=t=>{C.value=!0,D.value=`reciter-sura/${t.id}`},B=K(),E=()=>{B.on("reload-table",(t=!0)=>{console.log("value"),t&&r()})},N=t=>{const a=Math.floor(t/3600),c=Math.floor(t%3600/60),p=t%60,s=a>0?`${a}h `:"",y=c>0?`${c}m `:"",F=p>0?`${p}s`:"";return`${s}${y}${F}`.trim()};return L(()=>{r(),E()}),(t,a)=>{const c=x("app-loader"),p=x("app-delete-modal");return n(),l("main",O,[e("div",ee,[e("div",te,[e("h1",se,[e("strong",null,m(u.reciter.name)+" Audio Sura List",1)]),t.$canAccess("create_reciter_sura")?(n(),l("a",{key:0,href:"",onClick:a[0]||(a[0]=b(s=>v.value=!0,["prevent"])),class:"btn bg-primary text-white float-end"}," Add Sura ")):d("",!0)])]),e("div",oe,[T(e("input",{type:"text",class:"form-control","onUpdate:modelValue":a[1]||(a[1]=s=>_.value=s),onInput:a[2]||(a[2]=s=>o(A)()),placeholder:"Search..."},null,544),[[P,_.value]])]),e("div",ae,[e("div",ne,[e("div",le,[g.value?(n(),k(c,{key:0})):(n(),l("div",ce,[e("table",ie,[re,e("tbody",null,[(n(!0),l(U,null,z(f.value.data,s=>(n(),l("tr",null,[e("td",de,[e("div",ue,[e("div",_e,[e("span",pe,m(s.name),1)])])]),e("td",null,m(s.number),1),e("td",null,m(N(s.duration)),1),e("td",null,[e("a",{href:o(h)(s.path),target:"_blank"},[e("img",{class:"action_icon",src:o(h)("assets/img/icons/audio.png"),alt:"View file"},null,8,he)],8,me)]),e("td",ve,[e("div",fe,[t.$canAccess("update_reciter_sura")?(n(),l("div",ge,[e("a",{onClick:b(y=>I(s),["prevent"])},[e("img",{class:"action_icon",src:o(h)("assets/img/icons/edit.svg"),alt:"Edit Icon"},null,8,$e)],8,ye)])):d("",!0),t.$canAccess("delete_reciter_sura")?(n(),l("div",be,[e("a",{onClick:b(y=>V(s),["prevent"])},[e("img",{class:"action_icon",src:o(h)("assets/img/icons/trash.svg"),alt:"Trash Icon"},null,8,we)],8,ke)])):d("",!0)])])]))),256))])])])),G(o(W),{data:f.value,onPaginationChangePage:r},null,8,["data"])])])]),o(v)?(n(),k(X,{key:0,"modal-id":"reciter-modal","selected-url":o(w),"reciter-id":u.reciter.id,"reciter-name":u.reciter.name,onClose:o(S)},null,8,["selected-url","reciter-id","reciter-name","onClose"])):d("",!0),o(C)?(n(),k(p,{key:1,"selected-url":o(D),onCancelled:o(M)},null,8,["selected-url","onCancelled"])):d("",!0)])}}},Pe=Z(De,[["__scopeId","data-v-a9dcb3ff"]]);export{Pe as default};
