Files
Čarodej ed17ed1a79 build
2022-05-10 11:17:01 +02:00

1 line
19 KiB
JavaScript
Vendored

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7861],{3058:(t,a,e)=>{e.d(a,{Z:()=>n});var s=e(3645),i=e.n(s)()((function(t){return t[1]}));i.push([t.id,".input-wrapper[data-v-1e835bde]{display:flex;width:100%}.input-wrapper .input-label[data-v-1e835bde]{color:#1b2539}.input-wrapper .switch-content[data-v-1e835bde]{width:100%}.input-wrapper .switch-content[data-v-1e835bde]:last-child{width:80px}.switch[data-v-1e835bde]{background:#f1f1f5;height:28px;position:relative;width:50px}.switch[data-v-1e835bde],.switch .switch-button[data-v-1e835bde]{border-radius:50px;display:block;transition:all .3s ease}.switch .switch-button[data-v-1e835bde]{background:#fff;box-shadow:0 2px 4px rgba(37,38,94,.1);cursor:pointer;height:22px;left:3px;position:absolute;top:3px;width:22px}.switch.active .switch-button[data-v-1e835bde]{left:25px}.dark .switch[data-v-1e835bde]{background:#1e2024}.dark .popup-wrapper .switch[data-v-1e835bde]{background:#25272c}",""]);const n=i},7520:(t,a,e)=>{e.d(a,{Z:()=>n});var s=e(3645),i=e.n(s)()((function(t){return t[1]}));i.push([t.id,".color-label.purple[data-v-3ff27c4c]{background:rgba(157,102,254,.1);color:#9d66fe}.color-label.yellow[data-v-3ff27c4c]{background:rgba(255,189,45,.1);color:#ffbd2d}.color-label.green[data-v-3ff27c4c]{background:rgba(0,188,126,.1);color:#00bc7e}.color-label.red[data-v-3ff27c4c]{background:rgba(253,57,122,.1);color:#fd397a}",""]);const n=i},2424:(t,a,e)=>{e.d(a,{Z:()=>n});var s=e(3645),i=e.n(s)()((function(t){return t[1]}));i.push([t.id,".table-row[data-v-61827e38]{border-radius:8px}.table-row[data-v-61827e38]:hover{background:#f4f5f6}.table-row .table-cell[data-v-61827e38]{padding-bottom:15px;padding-top:15px}.table-row .table-cell[data-v-61827e38]:first-child{padding-left:15px}.table-row .table-cell[data-v-61827e38]:last-child{padding-right:15px;text-align:right}.table-row .table-cell span[data-v-61827e38]{font-size:1em;font-weight:700}",""]);const n=i},7215:(t,a,e)=>{e.d(a,{Z:()=>o});const s={name:"SwitchInput",props:["label","name","state","info","input","isDisabled"],data:function(){return{isSwitched:void 0}},methods:{changeState:function(){this.isDisabled||(this.isSwitched=!this.isSwitched,this.$emit("input",this.isSwitched))}},mounted:function(){this.isSwitched=this.state}};var i=e(3379),n=e.n(i),l=e(3058),r={insert:"head",singleton:!1};n()(l.Z,r);l.Z.locals;const o=(0,e(1900).Z)(s,(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",[e("div",{staticClass:"switch-content"},[t.label?e("label",{staticClass:"input-label"},[t._v(" "+t._s(t.label)+": ")]):t._e(),t._v(" "),t.info?e("small",{staticClass:"input-info"},[t._v("\n "+t._s(t.info)+"\n ")]):t._e()]),t._v(" "),e("div",{staticClass:"switch-content text-right"},[e("div",{staticClass:"switch",class:{active:t.state},on:{click:t.changeState}},[e("div",{staticClass:"switch-button"})])])])}),[],!1,null,"1e835bde",null).exports},3346:(t,a,e)=>{e.d(a,{Z:()=>o});const s={name:"ColorLabel",props:["color"]};var i=e(3379),n=e.n(i),l=e(7520),r={insert:"head",singleton:!1};n()(l.Z,r);l.Z.locals;const o=(0,e(1900).Z)(s,(function(){var t=this,a=t.$createElement;return(t._self._c||a)("b",{staticClass:"color-label inline-block rounded-lg py-1 px-2 text-xs font-bold capitalize",class:t.color},[t._t("default")],2)}),[],!1,null,"3ff27c4c",null).exports},3233:(t,a,e)=>{e.d(a,{Z:()=>g});var s=e(9101);const i={props:["data"],computed:{normalizedColumns:function(){return this.data.id&&delete this.data.id,Object.values(this.data)}}};var n=e(3379),l=e.n(n),r=e(2424),o={insert:"head",singleton:!1};l()(r.Z,o);r.Z.locals;var c=e(1900);const d=(0,c.Z)(i,(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("tr",{staticClass:"table-row"},t._l(t.normalizedColumns,(function(a,s){return e("td",{key:s,staticClass:"table-cell"},[e("span",[t._v(t._s(a))])])})),0)}),[],!1,null,"61827e38",null).exports;var u=e(9669),p=e.n(u);const b={name:"DatatableWrapper",props:["paginator","tableData","columns","scope","api"],components:{ChevronRightIcon:s.XCv,ChevronLeftIcon:s.wyc,DatatableCell:d,ChevronUpIcon:s.g8U},computed:{hasData:function(){return this.data&&this.data.data&&this.data.data.length>0},floatPages:function(){return[this.pageIndex-1,this.pageIndex,this.pageIndex+1]}},data:function(){return{data:void 0,isLoading:!0,pageIndex:1,filter:{sort:"DESC",field:void 0}}},methods:{goToPage:function(t){t>this.data.meta.last_page||0===t||(this.pageIndex=t,this.getPage(t))},sort:function(t,a){a&&(this.filter.field=t,"DESC"===this.filter.sort?this.filter.sort="ASC":"ASC"===this.filter.sort&&(this.filter.sort="DESC"),this.getPage(this.pageIndex))},getPage:function(t){var a=this;this.URI=this.api,this.paginator&&(this.URI=this.URI+"?page="+t),this.filter.field&&(this.URI=this.URI+(this.paginator?"&":"?")+"sort="+this.filter.field+"&direction="+this.filter.sort),this.isLoading=!0,p().get(this.URI).then((function(t){a.data=t.data,a.$emit("data",t.data)})).catch((function(){return a.$isSomethingWrong()})).finally((function(){a.$emit("init",!0),a.isLoading=!1}))}},created:function(){this.api&&this.getPage(this.pageIndex),this.tableData&&(this.data=this.tableData,this.isLoading=!1)}};const g=(0,c.Z)(b,(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticClass:"w-full"},[t.hasData?e("table",{staticClass:"w-full"},[e("thead",[e("tr",{staticClass:"whitespace-nowrap"},t._l(t.columns,(function(a,s){return a.hidden?t._e():e("th",{key:s,staticClass:"text-left",class:{"sortable cursor-pointer":a.sortable,"text-right":Object.values(t.columns).length-1===s},on:{click:function(e){return t.sort(a.field,a.sortable)}}},[e("span",{staticClass:"text-xs text-gray-400 dark:text-gray-500"},[t._v("\n "+t._s(t.$t(a.label))+"\n ")]),t._v(" "),a.sortable?e("chevron-up-icon",{staticClass:"vue-feather inline-block text-gray-300 dark:text-gray-500",class:{"arrow-down":"ASC"===t.filter.sort},attrs:{size:"12"}}):t._e()],1)})),0)]),t._v(" "),e("tbody",{staticClass:"table-body"},[t._l(t.data.data,(function(a){return t._t("default",(function(){return[e("DatatableCell",{key:a.id,attrs:{data:a}})]}),{row:a})}))],2)]):t._e(),t._v(" "),t.isLoading||t.hasData?t._e():t._t("empty-page"),t._v(" "),t.paginator&&t.hasData?e("div",{staticClass:"mt-6 sm:flex sm:items-center sm:justify-between"},[t.data.meta.total>15&&t.data.meta.last_page<=6?e("ul",{staticClass:"pagination flex justify-center items-center"},[e("li",{staticClass:"previous inline-block p-1"},[e("a",{staticClass:"page-link",class:{"cursor-default opacity-20":1===t.pageIndex},on:{click:function(a){return t.goToPage(t.pageIndex-1)}}},[e("chevron-left-icon",{staticClass:"inline-block",attrs:{size:"14"}})],1)]),t._v(" "),t._l(t.data.meta.last_page,(function(a,s){return e("li",{key:s,staticClass:"inline-block p-1",on:{click:function(e){return t.goToPage(a)}}},[e("a",{staticClass:"page-link",class:{"bg-light-background dark:bg-4x-dark-foreground dark:text-gray-300":t.pageIndex===a}},[t._v("\n "+t._s(a)+"\n ")])])})),t._v(" "),e("li",{staticClass:"next inline-block p-1"},[e("a",{staticClass:"page-link",class:{"cursor-default opacity-20":t.pageIndex===t.data.meta.last_page},on:{click:function(a){return t.goToPage(t.pageIndex+1)}}},[e("chevron-right-icon",{staticClass:"inline-block",attrs:{size:"14"}})],1)])],2):t._e(),t._v(" "),t.data.meta.total>15&&t.data.meta.last_page>6?e("ul",{staticClass:"pagination flex justify-center items-center"},[e("li",{staticClass:"previous inline-block p-1"},[e("a",{staticClass:"page-link",class:{"cursor-default opacity-20":1===t.pageIndex},on:{click:function(a){return t.goToPage(t.pageIndex-1)}}},[e("chevron-left-icon",{staticClass:"inline-block",attrs:{size:"14"}})],1)]),t._v(" "),t.pageIndex>=5?e("li",{staticClass:"inline-block p-1",on:{click:function(a){return t.goToPage(1)}}},[e("a",{staticClass:"page-link"},[t._v(" 1 ")])]):t._e(),t._v(" "),t._l(5,(function(a,s){return t.pageIndex<5?e("li",{key:s,staticClass:"inline-block p-1",on:{click:function(e){return t.goToPage(a)}}},[e("a",{staticClass:"page-link",class:{"bg-light-background dark:bg-4x-dark-foreground dark:text-gray-300":t.pageIndex===a}},[t._v("\n "+t._s(a)+"\n ")])]):t._e()})),t._v(" "),t.pageIndex>=5?e("li",{staticClass:"inline-block p-1"},[e("a",{staticClass:"page-link"},[t._v("...")])]):t._e(),t._v(" "),t._l(t.floatPages,(function(a,s){return t.pageIndex>=5&&t.pageIndex<t.data.meta.last_page-3?e("li",{key:s,staticClass:"inline-block p-1",on:{click:function(e){return t.goToPage(a)}}},[e("a",{staticClass:"page-link",class:{"bg-light-background dark:bg-4x-dark-foreground dark:text-gray-300":t.pageIndex===a}},[t._v("\n "+t._s(a)+"\n ")])]):t._e()})),t._v(" "),t.pageIndex<t.data.meta.last_page-3?e("li",{staticClass:"inline-block p-1"},[e("a",{staticClass:"page-link"},[t._v("...")])]):t._e(),t._v(" "),t._l(5,(function(a,s){return t.pageIndex>t.data.meta.last_page-4?e("li",{key:s,staticClass:"inline-block p-1",on:{click:function(a){t.goToPage(t.data.meta.last_page-(4-s))}}},[e("a",{staticClass:"page-link",class:{"bg-light-background dark:bg-4x-dark-foreground dark:text-gray-300":t.pageIndex===t.data.meta.last_page-(4-s)}},[t._v("\n "+t._s(t.data.meta.last_page-(4-s))+"\n ")])]):t._e()})),t._v(" "),t.pageIndex<t.data.meta.last_page-3?e("li",{staticClass:"inline-block p-1",on:{click:function(a){return t.goToPage(t.data.meta.last_page)}}},[e("a",{staticClass:"page-link"},[t._v("\n "+t._s(t.data.meta.last_page)+"\n ")])]):t._e(),t._v(" "),e("li",{staticClass:"next inline-block p-1"},[e("a",{staticClass:"page-link",class:{"cursor-default opacity-20":t.pageIndex===t.data.meta.last_page},on:{click:function(a){return t.goToPage(t.pageIndex+1)}}},[e("chevron-right-icon",{staticClass:"inline-block",attrs:{size:"14"}})],1)])],2):t._e(),t._v(" "),e("span",{staticClass:"text-xs text-gray-600 dark:text-gray-500 block text-center sm:mt-0 mt-4"},[t._v("\n\t\t\t\t"+t._s(t.$t("paginator",{from:t.data.meta.from,to:t.data.meta.to,total:t.data.meta.total}))+"\n ")])]):t._e()],2)}),[],!1,null,null,null).exports},3022:(t,a,e)=>{e.r(a),e.d(a,{default:()=>f});var s=e(3233),i=e(4388),n=e(7215),l=e(1612),r=e(3346),o=e(9101),c=e(629),d=e(826);function u(t,a){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);a&&(s=s.filter((function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable}))),e.push.apply(e,s)}return e}function p(t){for(var a=1;a<arguments.length;a++){var e=null!=arguments[a]?arguments[a]:{};a%2?u(Object(e),!0).forEach((function(a){b(t,a,e[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(e,a))}))}return t}function b(t,a,e){return a in t?Object.defineProperty(t,a,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[a]=e,t}const g={name:"Plans",components:{MobileActionButton:i.Z,DatatableWrapper:s.Z,SwitchInput:n.Z,ColorLabel:r.Z,Trash2Icon:o.Bf1,ButtonBase:l.Z,Edit2Icon:o.me4},computed:p(p({},(0,c.Se)(["config"])),{},{createPlanRoute:function(){return{metered:"CreateMeteredPlan",fixed:"CreateFixedPlan"}[this.config.subscriptionType]},columns:function(){return{metered:[{label:this.$t("name"),field:"name",sortable:!0},{label:this.$t("status"),field:"status",sortable:!0},{label:this.$t("currency"),field:"currency",sortable:!0},{label:this.$t("interval"),field:"interval",sortable:!0},{label:this.$t("subscribers"),sortable:!1},{label:this.$t("action"),sortable:!1}],fixed:[{label:this.$t("visibility"),field:"visible",sortable:!0},{label:this.$t("name"),field:"name",sortable:!0},{label:this.$t("status"),field:"status",sortable:!0},{label:this.$t("price"),field:"amount",sortable:!0},{label:this.$t("interval"),field:"interval",sortable:!0},{label:this.$t("subscribers"),sortable:!1},{label:this.$t("storage"),sortable:!1},{label:this.$t("action"),sortable:!1}]}[this.config.subscriptionType]}}),methods:{synchronizePlans:function(){var t=this,a=setTimeout((function(){t.$store.commit("PROCESSING_POPUP",{title:t.$t("synchronizing_plans"),message:t.$t("plans_are_synchronizing")})}),300);axios.get("/api/subscriptions/admin/plans/synchronize").then((function(){d.U.$emit("toaster",{type:"success",message:t.$t("plans_was_synchronized")})})).catch((function(t){500===t.response.status&&t.response.data.type&&d.U.$emit("alert:open",{title:t.response.data.title,message:t.response.data.message})})).finally((function(){clearTimeout(a),t.$store.commit("PROCESSING_POPUP",void 0)}))}}};const f=(0,e(1900).Z)(g,(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",[t.config.isEmptyPlans?t._e():e("div",{staticClass:"card shadow-card"},[t.config.isCreatedMeteredPlan&&"fixed"!==t.config.subscriptionType?t._e():e("div",{staticClass:"mb-6"},[e("router-link",{attrs:{to:{name:t.createPlanRoute}}},[e("MobileActionButton",{attrs:{icon:"plus"}},[t._v("\n "+t._s(t.$t("create_plan"))+"\n ")])],1),t._v(" "),e("MobileActionButton",{attrs:{icon:"refresh"},nativeOn:{click:function(a){return t.synchronizePlans.apply(null,arguments)}}},[t._v("\n\t\t\t\t\t"+t._s(t.$t("synchronize_plans"))+"\n\t\t\t\t")])],1),t._v(" "),e("DatatableWrapper",{staticClass:"overflow-x-auto",attrs:{api:"/api/subscriptions/admin/plans",paginator:!0,columns:t.columns},on:{data:function(a){t.plans=a},init:function(a){t.isLoading=!1}},scopedSlots:t._u([{key:"default",fn:function(a){var s=a.row;return["metered"===t.config.subscriptionType?e("tr",{staticClass:"whitespace-nowrap border-b border-dashed border-light dark:border-opacity-5"},[e("td",{staticClass:"py-5 pr-3 md:pr-1"},[e("router-link",{staticClass:"text-sm font-bold",attrs:{to:{name:"PlanMeteredSettings",params:{id:s.data.id}}}},[t._v("\n "+t._s(s.data.attributes.name)+"\n ")])],1),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("ColorLabel",{attrs:{color:t.$getPlanStatusColor(s.data.attributes.status)}},[t._v("\n "+t._s(t.$t(s.data.attributes.status))+"\n ")])],1),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("span",{staticClass:"text-sm font-bold"},[t._v("\n "+t._s(s.data.attributes.currency)+"\n ")])]),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("span",{staticClass:"text-sm font-bold capitalize"},[t._v("\n "+t._s(t.$t(s.data.attributes.interval))+"\n ")])]),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("span",{staticClass:"text-sm font-bold"},[t._v("\n "+t._s(s.data.attributes.subscribers)+"\n ")])]),t._v(" "),e("td",{staticClass:"pl-3 text-right md:pl-1"},[e("div",{staticClass:"flex w-full justify-end space-x-2"},[e("router-link",{staticClass:"flex h-8 w-8 items-center justify-center rounded-md bg-light-background transition-colors hover:bg-green-100 dark:bg-2x-dark-foreground",attrs:{to:{name:"PlanMeteredSettings",params:{id:s.data.id}}}},[e("Edit2Icon",{staticClass:"opacity-75",attrs:{size:"15"}})],1),t._v(" "),"archived"!==s.data.attributes.status?e("router-link",{staticClass:"flex h-8 w-8 items-center justify-center rounded-md bg-light-background transition-colors hover:bg-red-100 dark:bg-2x-dark-foreground",attrs:{to:{name:"PlanMeteredDelete",params:{id:s.data.id}}}},[e("Trash2Icon",{staticClass:"opacity-75",attrs:{size:"15"}})],1):t._e()],1)])]):t._e(),t._v(" "),"fixed"===t.config.subscriptionType?e("tr",{staticClass:"whitespace-nowrap border-b border-dashed border-light dark:border-opacity-5"},[e("td",{staticClass:"py-5 pr-3 md:pr-1"},["archived"===s.data.attributes.status?e("span",{staticClass:"ml-6 text-gray-300"},[t._v("-")]):t._e(),t._v(" "),"active"===s.data.attributes.status?e("SwitchInput",{staticClass:"switch",attrs:{state:s.data.attributes.visible},on:{input:function(a){return t.$updateInput("/subscriptions/admin/plans/"+s.data.id,"visible",s.data.attributes.visible)}},model:{value:s.data.attributes.visible,callback:function(a){t.$set(s.data.attributes,"visible",a)},expression:"row.data.attributes.visible"}}):t._e()],1),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("router-link",{staticClass:"text-sm font-bold",attrs:{to:{name:"PlanFixedSettings",params:{id:s.data.id}}}},[t._v("\n "+t._s(s.data.attributes.name)+"\n ")])],1),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("ColorLabel",{attrs:{color:t.$getPlanStatusColor(s.data.attributes.status)}},[t._v("\n "+t._s(t.$t(s.data.attributes.status))+"\n ")])],1),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("span",{staticClass:"text-sm font-bold"},[t._v("\n "+t._s(s.data.attributes.price)+"\n ")])]),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("span",{staticClass:"text-sm font-bold capitalize"},[t._v("\n "+t._s(t.$t(s.data.attributes.interval))+"\n ")])]),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("span",{staticClass:"text-sm font-bold"},[t._v("\n "+t._s(s.data.attributes.subscribers)+"\n ")])]),t._v(" "),e("td",{staticClass:"px-3 md:px-1"},[e("span",{staticClass:"text-sm font-bold"},[t._v("\n "+t._s(s.data.attributes.features.max_storage_amount)+"\n GB\n ")])]),t._v(" "),e("td",{staticClass:"pl-3 text-right md:pl-1"},[e("div",{staticClass:"flex w-full justify-end space-x-2"},[e("router-link",{staticClass:"flex h-8 w-8 items-center justify-center rounded-md bg-light-background transition-colors hover:bg-green-100 dark:bg-2x-dark-foreground",attrs:{to:{name:"PlanFixedSettings",params:{id:s.data.id}}}},[e("Edit2Icon",{staticClass:"opacity-75",attrs:{size:"15"}})],1),t._v(" "),e("router-link",{staticClass:"flex h-8 w-8 items-center justify-center rounded-md bg-light-background transition-colors hover:bg-red-100 dark:bg-2x-dark-foreground",attrs:{to:{name:"PlanFixedDelete",params:{id:s.data.id}}}},[e("Trash2Icon",{staticClass:"opacity-75",attrs:{size:"15"}})],1)],1)])]):t._e()]}}],null,!1,932234077)})],1),t._v(" "),t.config.isEmptyPlans?e("div",{staticClass:"flex items-center justify-center fixed top-0 bottom-0 left-0 right-0"},[e("div",{staticClass:"text-center"},[e("img",{staticClass:"mb-6 inline-block w-28",attrs:{src:"https://twemoji.maxcdn.com/v/13.1.0/svg/1f9fe.svg",alt:"transaction"}}),t._v(" "),e("h1",{staticClass:"mb-1 text-2xl font-bold"},[t._v("\n "+t._s(t.$t("there_is_nothing"))+"\n ")]),t._v(" "),e("p",{staticClass:"text-sm text-gray-600"},[t._v("\n "+t._s(t.$t("all_visible_plans_here"))+"\n ")]),t._v(" "),e("router-link",{staticClass:"mt-6 inline-block",attrs:{to:{name:t.createPlanRoute}}},[e("ButtonBase",{staticClass:"action-confirm",attrs:{"button-style":"theme"}},[t._v("\n "+t._s(t.$t("create_first_plan"))+"\n ")])],1)],1)]):t._e()])}),[],!1,null,null,null).exports}}]);