"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[8214],{1821:function(e,t,n){n.r(t),n.d(t,{default:function(){return s}});var r=function(){var e=this,t=e._self._c;return t("modal-select-prop-docs",{ref:"modal",attrs:{parentDocId:e.parentDocId,values:e.value,canCreate:e.canCreate,multiple:e.multiple},on:{init:e.init,change:function(t){return e.$emit("change",t)},close:e.closed,"document-create":function(t){return e.createDocument()},"document-open":function(t){return e.$emit("document-open",t)}}})},i=[],l=n(3216),a=(n(8559),{name:"fieldDocument",components:{ModalSelectPropDocs:()=>n.e(5280).then(n.bind(n,6913))},data:()=>({creating:!1}),props:{field:Object,value:{type:Array,default:()=>[]}},computed:{canCreate(){return!(!this.field||!this.field.DOCUMENT_ID)&&!!(this.field.DOCPROP_SQL%10)},multiple(){return!!this.field&&!!this.field.DOCPROP_MULTI},parentDocId(){return this.field?parseInt(this.field.DOCUMENT_ID):null}},beforeDestroy(){},mounted(){},methods:{init(){this.$refs.modal.open(this.field)},save(){this.$refs.modal.close()},async createDocument(){this.creating=!0;let e=await l.vd.query("CARABI_DOCUMENT_REF_CREATE_CS",{DOCUMENT_ID:this.field.DOCUMENT_ID,DOCPROP_ID:this.field.DOCPROP_ID}),t=e.CUR[0].DOCUMENT_ID;this.$emit("document-open",t),this.$emit("close"),this.creating=!1},closed(){this.creating||this.$emit("close")}}}),o=a,c=n(1656),u=(0,c.A)(o,r,i,!1,null,null,null),s=u.exports},8559:function(e,t){class n{convert_params(e,t){let n={};for(let r in t)n[r]="",void 0!==e[t[r]]&&(n[r]=e[t[r]]);return n}convert_sort(e){if(!e)return"";e=JSON.parse(e);let t="";for(let n in e){let r=e[n];""!=t&&(t+=","),t+=r.dataIndx+" "+("up"==r.dir?"ASC":"DESC")}return t}convert_filter(e){return JSON.stringify({filter:this.convert_filter_obj(e)})}convert_filter_obj(e){if(!e)return[];e=JSON.parse(e);let t=[],n={begin:"=",gte:">=",lte:"<=",between:">="};if(e&&e.data)for(let r in e.data){let i=e.data[r];void 0!==n[i.condition]&&t.push({field_name:i.dataIndx,value:i.value,operator:n[i.condition]}),"between"==i.condition&&t.push({field_name:i.dataIndx,value:i.value2,operator:"<="})}return t}calc_full_count(e,t,n,r){let i=(t-1)*n+r;return e<i&&(e=r==n?(t+1)*n:i),e}fix_row_count(e,t,n,r){let i=t+r;return e<i&&(e=r===n?t+2*n:i),e}}t.A=new n}}]);
//# sourceMappingURL=FieldDocument.c0933d88.js.map