Files
crater/public/build/assets/EstimateIndexDropdown.8f4bf538.js
Mohit Panjwani 68575b69b9 new build 603
2022-02-16 10:47:32 +05:30

2 lines
5.5 KiB
JavaScript

import{k as R,c as z,u as P,j as V,e as J,g as E}from"./main.06577e8c.js";import{ah as O,J as U,G as H,aN as W,r as T,o as i,l,w as r,u as n,f as m,i as u,t as d,j as g}from"./vendor.d12b5734.js";const G={props:{row:{type:Object,default:null},table:{type:Object,default:null}},setup(o){const y=o,S=O("utils"),k=R(),D=z(),_=P(),p=V(),f=J(),{t:s}=U(),v=H(),b=W();async function C(e){p.openDialog({title:s("general.are_you_sure"),message:s("estimates.confirm_delete"),yesLabel:s("general.ok"),noLabel:s("general.cancel"),variant:"danger",hideNoButton:!1,size:"lg"}).then(t=>{e=e,t&&k.deleteEstimate({ids:[e]}).then(a=>{a&&(y.table&&y.table.refresh(),a.data&&b.push("/admin/estimates"),k.$patch(h=>{h.selectedEstimates=[],h.selectAllField=!1}))})})}function $(e){p.openDialog({title:s("general.are_you_sure"),message:s("estimates.confirm_conversion"),yesLabel:s("general.ok"),noLabel:s("general.cancel"),variant:"primary",hideNoButton:!1,size:"lg"}).then(t=>{t&&k.convertToInvoice(e).then(a=>{a.data&&b.push(`/admin/invoices/${a.data.data.id}/edit`)})})}async function N(e){p.openDialog({title:s("general.are_you_sure"),message:s("estimates.confirm_mark_as_sent"),yesLabel:s("general.ok"),noLabel:s("general.cancel"),variant:"primary",hideNoButton:!1,size:"lg"}).then(t=>{const a={id:e,status:"SENT"};t&&k.markAsSent(a).then(h=>{y.table&&y.table.refresh()})})}function x(e){return(e.status=="SENT"||e.status=="VIEWED")&&v.name!=="estimates.view"&&f.hasAbilities(E.SEND_ESTIMATE)}async function I(e){D.openModal({title:s("estimates.send_estimate"),componentName:"SendEstimateModal",id:e.id,data:e,variant:"lg"})}async function B(e){p.openDialog({title:s("general.are_you_sure"),message:s("estimates.confirm_mark_as_accepted"),yesLabel:s("general.ok"),noLabel:s("general.cancel"),variant:"primary",hideNoButton:!1,size:"lg"}).then(t=>{const a={id:e,status:"ACCEPTED"};t&&k.markAsAccepted(a).then(h=>{y.table&&y.table.refresh()})})}async function M(e){p.openDialog({title:s("general.are_you_sure"),message:s("estimates.confirm_mark_as_rejected"),yesLabel:s("general.ok"),noLabel:s("general.cancel"),variant:"primary",hideNoButton:!1,size:"lg"}).then(t=>{const a={id:e,status:"REJECTED"};t&&k.markAsRejected(a).then(h=>{y.table&&y.table.refresh()})})}function L(){let e=`${window.location.origin}/estimates/pdf/${y.row.unique_hash}`;S.copyTextToClipboard(e),_.showNotification({type:"success",message:s("general.copied_pdf_url_clipboard")})}return(e,t)=>{const a=T("BaseIcon"),h=T("BaseButton"),c=T("BaseDropdownItem"),A=T("router-link"),j=T("BaseDropdown");return i(),l(j,null,{activator:r(()=>[n(v).name==="estimates.view"?(i(),l(h,{key:0,variant:"primary"},{default:r(()=>[m(a,{name:"DotsHorizontalIcon",class:"text-white"})]),_:1})):(i(),l(a,{key:1,class:"text-gray-500",name:"DotsHorizontalIcon"}))]),default:r(()=>[n(v).name==="estimates.view"?(i(),l(c,{key:0,onClick:L},{default:r(()=>[m(a,{name:"LinkIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("general.copy_pdf_url")),1)]),_:1})):g("",!0),n(f).hasAbilities(n(E).EDIT_ESTIMATE)?(i(),l(A,{key:1,to:`/admin/estimates/${o.row.id}/edit`},{default:r(()=>[m(c,null,{default:r(()=>[m(a,{name:"PencilIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("general.edit")),1)]),_:1})]),_:1},8,["to"])):g("",!0),n(f).hasAbilities(n(E).DELETE_ESTIMATE)?(i(),l(c,{key:2,onClick:t[0]||(t[0]=w=>C(o.row.id))},{default:r(()=>[m(a,{name:"TrashIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("general.delete")),1)]),_:1})):g("",!0),n(v).name!=="estimates.view"&&n(f).hasAbilities(n(E).VIEW_ESTIMATE)?(i(),l(A,{key:3,to:`estimates/${o.row.id}/view`},{default:r(()=>[m(c,null,{default:r(()=>[m(a,{name:"EyeIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("general.view")),1)]),_:1})]),_:1},8,["to"])):g("",!0),n(f).hasAbilities(n(E).CREATE_INVOICE)?(i(),l(c,{key:4,onClick:t[1]||(t[1]=w=>$(o.row.id))},{default:r(()=>[m(a,{name:"DocumentTextIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("estimates.convert_to_invoice")),1)]),_:1})):g("",!0),o.row.status!=="SENT"&&n(v).name!=="estimates.view"&&n(f).hasAbilities(n(E).SEND_ESTIMATE)?(i(),l(c,{key:5,onClick:t[2]||(t[2]=w=>N(o.row.id))},{default:r(()=>[m(a,{name:"CheckCircleIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("estimates.mark_as_sent")),1)]),_:1})):g("",!0),o.row.status!=="SENT"&&n(v).name!=="estimates.view"&&n(f).hasAbilities(n(E).SEND_ESTIMATE)?(i(),l(c,{key:6,onClick:t[3]||(t[3]=w=>I(o.row))},{default:r(()=>[m(a,{name:"PaperAirplaneIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("estimates.send_estimate")),1)]),_:1})):g("",!0),x(o.row)?(i(),l(c,{key:7,onClick:t[4]||(t[4]=w=>I(o.row))},{default:r(()=>[m(a,{name:"PaperAirplaneIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("estimates.resend_estimate")),1)]),_:1})):g("",!0),o.row.status!=="ACCEPTED"&&n(f).hasAbilities(n(E).EDIT_ESTIMATE)?(i(),l(c,{key:8,onClick:t[5]||(t[5]=w=>B(o.row.id))},{default:r(()=>[m(a,{name:"CheckCircleIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("estimates.mark_as_accepted")),1)]),_:1})):g("",!0),o.row.status!=="REJECTED"&&n(f).hasAbilities(n(E).EDIT_ESTIMATE)?(i(),l(c,{key:9,onClick:t[6]||(t[6]=w=>M(o.row.id))},{default:r(()=>[m(a,{name:"XCircleIcon",class:"w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500"}),u(" "+d(e.$t("estimates.mark_as_rejected")),1)]),_:1})):g("",!0)]),_:1})}}};export{G as _};