1"use strict";((self||this).webpackChunk=(self||this).webpackChunk||[]).push([[6074],{16074:(t,e,s)=>{s.r(e),s.d(e,{default:()=>i});const n={name:"Tags",props:{tagIds:Array,connectedTags:Array,id:String},data:function(){return{search:"",tags:[],timeout:null,searching:!1,exist:!1}},watch:{search:function(){this.searching=!0,this.waitSearch()}},methods:{addTag:function(t){this.$emit("addTag",t),this.search=""},removeTag:function(t){this.$emit("removeTag",t)},findTagName:function(t){return-1!==this.connectedTags.findIndex((function(e){return e.name.toUpperCase()===t.toUpperCase()}))},addNewTag:function(t){var e=this.tags.findIndex((function(e){return e.name.toUpperCase()===t.toUpperCase()}));this.addTag({id:this.tags[e].id,name:this.tags[e].name})},findInTagIds:function(t){return-1===this.tagIds.indexOf(t)},isNotEmpty:function(t){return t.replace(/\s/g,"").length},tagDoesExist:function(t){var e=this.tags.findIndex((function(e){return e.name.toUpperCase()===t.toUpperCase()}));this.exist=-1!==e,this.searching=!1},waitSearch:function(){var t=this;null===this.timeout?this.timeout=setTimeout((function(){t.fetchResult(),t.timeout=null}),500):(clearTimeout(this.timeout),this.timeout=setTimeout((function(){t.fetchResult(),t.timeout=null}),300))},fetchResult:function(t){var e=this;this.isNotEmpty(this.search)?this.axios.post(this.route("tag.list"),{search:this.search}).then((function(s){e.tags=s.data.tags,e.tagDoesExist(e.search),t&&e.addNewTag(e.search)})):(this.tags=[],this.searching=!1)},storeTag:function(){var t=this;this.$inertia.post(this.route("tag.store"),{name:this.search},{preserveState:!0,preserveScroll:!0,onFinish:function(){t.searching=!0,t.fetchResult(!0)}})}}};const i=(0,s(51900).Z)(n,(function(){var t=this,e=t._self._c;return e("div",[e("div",{staticClass:"mt-2 row d-flex align-items-center"},[e("div",{staticClass:"col-12 mx-0 mb-2 mt-1 p-0"},[e("div",{staticClass:"input-group"},[t._m(0),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.search,expression:"search"}],staticClass:"border-top border-bottom border-light form-control",attrs:{id:"tag-search-"+t.id,type:"text",maxlength:"25",placeholder:"Cerca un tag..."},domProps:{value:t.search},on:{input:function(e){e.target.composing||(t.search=e.target.value)}}}),t._v(" "),e("div",{staticClass:"input-group-append"},[e("div",[!t.isNotEmpty(t.search)||t.exist||t.searching||t.findTagName(t.search)?e("button",{staticClass:"text-white border-top border-bottom border-right border-left-0 border-light p-2",staticStyle:{"border-radius":"0 8px 8px 0",height:"45px","background-color":"white"}},[t._v("\n Crea il tag e collegalo\n ")]):e("button",{staticClass:"btn btn-sm bg-white text-dark border-top border-bottom border-right border-left-0 border-light p-2",staticStyle:{"border-radius":"0 8px 8px 0",height:"45px"},on:{click:t.storeTag}},[t._v("\n Crea il tag e collegalo\n ")])])])])])]),t._v(" "),e("div",{staticClass:"row d-flex align-items-center"},[t.tags.length?e("div",{staticClass:"col-12 p-2",class:t.tags.length?"border border-light rounded-lg":""},[t.connectedTags.length?e("p",{staticClass:"font-weight-semibold mb-1"},[t._v("\n Tag da aggiungere\n ")]):t._e(),t._v(" "),t._l(t.tags,(function(s){return t.findInTagIds(s.id)?e("span",{key:s.id,staticClass:"h5 px-1"},[e("button",{staticClass:"btn btn-sm text-primary btn-outline-primary rounded-lg px-1 py-0",attrs:{href:"#"},on:{click:function(e){return t.addTag({id:s.id,name:s.name})}}},[e("div",{staticClass:"d-flex align-items-center justify-content-end"},[e("span",{staticClass:"mr-1"},[t._v("#"+t._s(s.name))]),t._v(" "),e("svg",{staticClass:"my-1",staticStyle:{width:"18px"},attrs:{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"}},[e("path",{attrs:{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}})])])])]):t._e()}))],2):t._e(),t._v(" "),e("div",{staticClass:"col-12 m-0 mt-2 p-2",class:t.connectedTags.length?"border border-light rounded-lg":""},[t.connectedTags.length?e("p",{staticClass:"font-weight-semibold mb-1"},[t._v("\n Tag collegati\n ")]):e("p",{staticClass:"font-weight-bold m-0"},[t._v("\n â¹ï¸ Ancora nessun tag è collegato\n ")]),t._v(" "),t._l(t.connectedTags,(function(s,n){return e("span",{key:n,staticClass:"h5 pl-1"},[e("button",{staticClass:"btn btn-sm text-danger btn-outline-danger rounded-lg px-1 py-0",attrs:{href:"#"},on:{click:function(e){return t.removeTag(s.id)}}},[e("div",{staticClass:"d-flex align-items-center justify-content-end"},[e("span",{staticClass:"mr-1"},[t._v("#"+t._s(s.name))]),t._v(" "),e("svg",{staticClass:"my-1",staticStyle:{width:"18px"},attrs:{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"}},[e("path",{attrs:{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"}})])])])])}))],2)])])}),[function(){var t=this._self._c;return t("div",{staticClass:"input-group-prepend"},[t("span",{staticClass:"input-group-text rounded-left border-light border-left border-top border-bottom",staticStyle:{"border-radius":"8px 0 0 8px !important"}},[this._v("\n #\n ")])])}],!1,null,null,null).exports},51900:(t,e,s)=>{function n(t,e,s,n,i,a,r,o){var c,l="function"==typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=s,l._compiled=!0),n&&(l.functional=!0),a&&(l._scopeId="data-v-"+a),r?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},l._ssrRegister=c):i&&(c=o?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),c)if(l.functional){l._injectStyles=c;var d=l.render;l.render=function(t,e){return c.call(e),d(t,e)}}else{var h=l.beforeCreate;l.beforeCreate=h?[].concat(h,c):[c]}return{exports:t,options:l}}s.d(e,{Z:()=>n})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.