import{P as p}from"./PageHeader-02d7f181.js";import{_ as m,A as f}from"./_plugin-vue_export-helper-8019582c.js";import{r as g,o as r,c as d,d as D,b as s,t as a,h as u,F as _,i as y,k as v}from"./index-454c8244.js";const x={name:"IssueTrackingPage",setup(){},components:{PageHeader:p},props:{},data(){return{issueDetail:null,issueBasics:null,timeline:[]}},mounted(){this.getIssueDetail()},methods:{async getIssueDetail(){this.user&&JSON.parse(this.user).token;const t=await f.post("getIssueDetails",{session_id:this.$route.params.session_id,user_id:this.$route.params.user_id,type:this.$route.params.data_type,issue_type:this.$route.params.issue_type});console.log(t.data),t.data&&(this.issueDetail=t.data.detail,this.issueBasics=t.data.basic,this.timeline=t.data.timeline)},formattedTimestamp(t){const n={weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"numeric",hour12:!0},c=new Date(t),l=c.toLocaleString("en-US",n),e=c.getDate(),o=this.getDaySuffix(e);return l.replace(`${e}`,`${e}${o}`)},getDaySuffix(t){if(t>=11&&t<=13)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}},navigateToDestination(){this.$router.push({name:"issue-detailing",params:{data_id:this.issueDetail.data_id,session_id:this.issueDetail.session_id,user_id:this.issueDetail.user_id,data_type:this.issueDetail.data_type,issue_type:this.issueDetail.issue_type,issue_title:this.issueDetail.issue_title.replace(/ /g,"_")}})}}},w={class:"alert-classic top-space section-b-space pt-0"},b={class:"container py-4"},k={class:"mb-3"},B={class:"font-weight-light text-center text-muted py-3"},S=s("br",null,null,-1),T={class:"fw-light"},I={class:"row"},P=v('<div class="col-auto text-center flex-column d-none d-sm-flex"><div class="row h-50"><div class="col border-end"> </div><div class="col"> </div></div><h5 class="m-2"><span class="badge rounded-pill bg-success"> </span></h5><div class="row h-50"><div class="col border-end"> </div><div class="col"> </div></div></div>',1),F={class:"col py-2"},N={class:"card border-success shadow"},A={class:"card-body"},V={class:"float-end text-success"},H={class:"card-title text-success"},L={class:"card-text"},C={class:"d-flex justify-content-center my-4 px-3"};function O(t,n,c,l,e,o){const h=g("PageHeader");return r(),d(_,null,[D(h,{title:"Issue Tracking",backLink:"/issue/list"}),s("section",w,[s("div",b,[s("div",k,[s("h2",B,a(e.issueDetail&&e.issueDetail.issue_title),1),s("strong",null,"Site: "+a(e.issueDetail&&e.issueDetail.data_type==="FS"?"Fixed":"Outreach"),1),u(),S,s("strong",null,[u("Area: "),s("span",T,a(e.issueBasics&&e.issueBasics.area_site+" "+e.issueBasics.town_taluqa+", "+e.issueBasics.uc+", "+e.issueBasics.district),1)])]),(r(!0),d(_,null,y(e.timeline,(i,j)=>(r(),d("div",I,[P,s("div",F,[s("div",N,[s("div",A,[s("div",V,a(o.formattedTimestamp(i.created_at)),1),s("h4",H,a(i.follow_up===1?"1st":i.follow_up===2?"2nd":i.follow_up===3?"3rd":"4th")+" Follow up",1),s("p",L,a(i.description),1)])])])]))),256))]),s("div",C,[s("button",{class:"btn btn-secondary w-100",onClick:n[0]||(n[0]=(...i)=>o.navigateToDestination&&o.navigateToDestination(...i))},"Add Detail")])])],64)}const U=m(x,[["render",O]]);export{U as default};
