관리-도구
편집 파일: StoreMessages.1a5c97a32ce998b7.js
/*! For license information please see StoreMessages.1a5c97a32ce998b7.js.LICENSE.txt */ "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4254],{18940:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(76314),a=r.n(n)()((function(t){return t[1]}));a.push([t.id,".msg-body[data-v-13da493c]{white-space:pre-line}",""]);const o=a},66857:(t,e,r)=>{r.r(e),r.d(e,{default:()=>v});var n=r(72505),a=r.n(n);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(){s=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,r){return t[e]=r}}function d(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,s=Object.create(o.prototype),i=new O(n||[]);return a(s,"_invoke",{value:E(t,r,i)}),s}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=d;var v="suspendedStart",p="suspendedYield",g="executing",m="completed",y={};function b(){}function _(){}function w(){}var x={};h(x,c,(function(){return this}));var C=Object.getPrototypeOf,P=C&&C(C(T([])));P&&P!==r&&n.call(P,c)&&(x=P);var $=w.prototype=b.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(a,s,i,c){var l=f(t[a],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==o(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(h).then((function(t){u.value=t,i(u)}),(function(t){return r("throw",t,i,c)}))}c(l.arg)}var s;a(this,"_invoke",{value:function(t,n){function a(){return new e((function(e,a){r(t,n,e,a)}))}return s=s?s.then(a,a):a()}})}function E(e,r,n){var a=v;return function(o,s){if(a===g)throw Error("Generator is already running");if(a===m){if("throw"===o)throw s;return{value:t,done:!0}}for(n.method=o,n.arg=s;;){var i=n.delegate;if(i){var c=M(i,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===v)throw a=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=g;var l=f(e,r,n);if("normal"===l.type){if(a=n.done?m:p,l.arg===y)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(a=m,n.method="throw",n.arg=l.arg)}}}function M(e,r){var n=r.method,a=e.iterator[n];if(a===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,M(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=f(a,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var s=o.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,s=function r(){for(;++a<e.length;)if(n.call(e,a))return r.value=e[a],r.done=!1,r;return r.value=t,r.done=!0,r};return s.next=s}}throw new TypeError(o(e)+" is not iterable")}return _.prototype=w,a($,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:_,configurable:!0}),_.displayName=h(w,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,h(t,u,"GeneratorFunction")),t.prototype=Object.create($),t},e.awrap=function(t){return{__await:t}},L(k.prototype),h(k.prototype,l,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var s=new k(d(t,r,n,a),o);return e.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},L($),h($,u,"Generator"),h($,c,(function(){return this})),h($,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function a(n,a){return i.type="throw",i.arg=e,r.next=n,a&&(r.method="next",r.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],i=s.completion;if("root"===s.tryLoc)return a("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return a(s.catchLoc,!0);if(this.prev<s.finallyLoc)return a(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return a(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return a(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;j(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function i(t,e,r,n,a,o,s){try{var i=t[o](s),c=i.value}catch(t){return void r(t)}i.done?e(c):Promise.resolve(c).then(n,a)}function c(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var o=t.apply(e,r);function s(t){i(o,n,a,s,c,"next",t)}function c(t){i(o,n,a,s,c,"throw",t)}s(void 0)}))}}const l={metaInfo:{title:"Store Messages"},data:function(){return{isLoading:!0,searching:!1,rows:[],totalRows:0,searchQuery:"",onlyUnread:!1,t:null,serverParams:{page:1,perPage:10,sort:[{field:"created_at",type:"desc"}]},columns:[{label:this.$t("Name"),field:"name",sortable:!0},{label:this.$t("Email"),field:"email",sortable:!0},{label:this.$t("Subject"),field:"subject",sortable:!0},{label:this.$t("Status"),field:"is_read",sortable:!0},{label:this.$t("Received"),field:"created_at",sortable:!0},{label:this.$t("Actions"),field:"actions"}],selectedMsg:null,loadingOne:!1}},mounted:function(){this.fetch()},methods:{debouncedSearch:function(){var t=this;this.t&&clearTimeout(this.t),this.t=setTimeout((function(){t.fetch()}),350)},fetch:function(){var t=this;return c(s().mark((function e(){var r,n,o,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.isLoading=!0,t.searching=!0,e.prev=2,r=t.serverParams.sort&&t.serverParams.sort[0]?t.serverParams.sort[0].field:"created_at",n=t.serverParams.sort&&t.serverParams.sort[0]?t.serverParams.sort[0].type:"desc",e.next=7,a().get("/store/messages",{params:{page:t.serverParams.page,per_page:t.serverParams.perPage,sort:r,dir:n,q:t.searchQuery||"",unread:t.onlyUnread?1:0}});case 7:o=e.sent,i=o.data,t.rows=i&&i.data?i.data:[],t.totalRows=i&&i.meta&&void 0!==i.meta.total?i.meta.total:t.rows.length;case 11:return e.prev=11,t.isLoading=!1,t.searching=!1,e.finish(11);case 15:case"end":return e.stop()}}),e,null,[[2,,11,15]])})))()},onPageChange:function(t){var e=t.currentPage;this.serverParams.page=e,this.fetch()},onPerPageChange:function(t){var e=t.currentPerPage;this.serverParams.perPage=e,this.fetch()},onSortChange:function(t){this.serverParams.sort=t[0]?[t[0]]:[],this.fetch()},showMessage:function(t){var e=this;return c(s().mark((function r(){var n,o,i;return s().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.loadingOne=!0,e.selectedMsg=null,r.prev=2,r.next=5,a().get("/store/messages/"+t);case 5:n=r.sent,o=n.data,e.selectedMsg=o,i=0;case 9:if(!(i<e.rows.length)){r.next=16;break}if(e.rows[i].id!==t){r.next=13;break}return e.rows[i].is_read=!0,r.abrupt("break",16);case 13:i++,r.next=9;break;case 16:e.$bvModal&&e.$bvModal.show("messageModal");case 17:return r.prev=17,e.loadingOne=!1,r.finish(17);case 20:case"end":return r.stop()}}),r,null,[[2,,17,20]])})))()},remove:function(t){var e=this;e.$swal({title:e.$t("Delete_Title"),text:e.$t("Delete_Text"),type:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",cancelButtonText:e.$t("Delete_cancelButtonText"),confirmButtonText:e.$t("Delete_confirmButtonText")}).then((function(r){!(!r||!0!==r.value&&!0!==r.isConfirmed)&&a().delete("/store/messages/"+t).then((function(){e.$swal(e.$t("Delete_Deleted"),e.$t("Deleted_in_successfully"),"success"),e.fetch()})).catch((function(t){var r=t&&t.response&&t.response.data&&(t.response.data.message||t.response.data.error)||e.$t("Delete_Therewassomethingwronge");e.$swal(e.$t("Delete_Failed"),r,"warning")}))}))}}};var u=r(85072),h=r.n(u),d=r(18940),f={insert:"head",singleton:!1};h()(d.A,f);d.A.locals;const v=(0,r(14486).A)(l,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"main-content"},[e("breadcumb",{attrs:{page:t.$t("Messages"),folder:t.$t("Store")}}),t._v(" "),t.isLoading?e("div",{staticClass:"loading_page spinner spinner-primary mr-3"}):e("b-card",{staticClass:"wrapper"},[e("div",{staticClass:"d-flex flex-wrap align-items-center justify-content-between mb-3"},[e("div",{staticClass:"d-flex align-items-center gap-2"},[e("b-input-group",[e("b-form-input",{attrs:{placeholder:t.$t("Search_by_name_email_subject")+"…"},on:{input:t.debouncedSearch},model:{value:t.searchQuery,callback:function(e){t.searchQuery="string"==typeof e?e.trim():e},expression:"searchQuery"}}),t._v(" "),e("b-input-group-append",[e("b-button",{attrs:{variant:"outline-secondary",disabled:t.searching},on:{click:t.fetch}},[t.searching?e("span",{staticClass:"spinner-border spinner-border-sm mr-1"}):e("i",{staticClass:"i-Search-People"})])],1)],1),t._v(" "),e("b-form-checkbox",{staticClass:"ml-3",on:{change:t.fetch},model:{value:t.onlyUnread,callback:function(e){t.onlyUnread=e},expression:"onlyUnread"}},[t._v("\n "+t._s(t.$t("Unread_only"))+"\n ")])],1),t._v(" "),e("div")]),t._v(" "),e("vue-good-table",{attrs:{mode:"remote",columns:t.columns,rows:t.rows,totalRows:t.totalRows,"pagination-options":{enabled:!0,perPage:t.serverParams.perPage},"search-options":{enabled:!1},styleClass:"table-hover tableOne vgt-table"},on:{"on-page-change":t.onPageChange,"on-per-page-change":t.onPerPageChange,"on-sort-change":t.onSortChange},scopedSlots:t._u([{key:"table-row",fn:function(r){return["is_read"===r.column.field?e("span",[e("b-badge",{attrs:{variant:r.row.is_read?"secondary":"warning"}},[t._v("\n "+t._s(r.row.is_read?t.$t("Read"):t.$t("Unread"))+"\n ")])],1):"actions"===r.column.field?e("span",[e("a",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],attrs:{title:t.$t("View")},on:{click:function(e){return t.showMessage(r.row.id)}}},[e("i",{staticClass:"i-Eye text-20 text-primary"})]),t._v(" "),e("a",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],staticClass:"ml-2",attrs:{title:t.$t("Delete")},on:{click:function(e){return t.remove(r.row.id)}}},[e("i",{staticClass:"i-Close-Window text-20 text-danger"})])]):e("span",[t._v("\n "+t._s(r.formattedRow[r.column.field])+"\n ")])]}}])})],1),t._v(" "),e("b-modal",{attrs:{id:"messageModal",title:t.selectedMsg&&t.selectedMsg.subject||t.$t("Message"),"ok-only":!0,"ok-variant":"primary","ok-title":t.$t("Close"),size:"lg"},on:{hidden:function(e){t.selectedMsg=null}}},[t.loadingOne?e("div",{staticClass:"text-center my-4"},[e("span",{staticClass:"spinner-border"})]):t.selectedMsg?e("div",[e("div",{staticClass:"mb-2"},[e("div",{staticClass:"small text-muted"},[t._v(t._s(t.$t("From")))]),t._v(" "),e("div",{staticClass:"fw-600"},[t._v("\n "+t._s(t.selectedMsg.name)+"\n "),e("span",{staticClass:"text-muted"},[t._v("<"+t._s(t.selectedMsg.email)+">")]),t._v(" "),t.selectedMsg.phone?e("span",{staticClass:"text-muted"},[t._v(" • "+t._s(t.selectedMsg.phone))]):t._e()])]),t._v(" "),e("div",{staticClass:"mb-2"},[e("div",{staticClass:"small text-muted"},[t._v(t._s(t.$t("Subject")))]),t._v(" "),e("div",[t._v(t._s(t.selectedMsg.subject||"—"))])]),t._v(" "),e("div",{staticClass:"mb-2"},[e("div",{staticClass:"small text-muted"},[t._v(t._s(t.$t("Received")))]),t._v(" "),e("div",[t._v(t._s(t.selectedMsg.created_at))])]),t._v(" "),e("hr"),t._v(" "),e("div",{staticClass:"small text-muted mb-1"},[t._v(t._s(t.$t("Message")))]),t._v(" "),e("div",{staticClass:"msg-body"},[t._v(t._s(t.selectedMsg.message))])]):e("div",{staticClass:"text-muted"},[t._v("\n "+t._s(t.$t("No_message_selected"))+"\n ")])])],1)}),[],!1,null,"13da493c",null).exports}}]);