PageSourceSearch

https://application.betool.fr/js/7538.e6e3a016.js

js betool.fr collected 2026-09-24 15:03:18 UTC 13,067 bytes, 1 lines download raw bytes

1"use strict";(self["webpackChunkcrm"]=self["webpackChunkcrm"]||[]).push([[7538],{57538(e,t,i){i.r(t),i.d(t,{default:()=>y});var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return e.isQuantityVisible||e.isSelectProductVisible?i("div",{staticStyle:{"margin-top":"10px"}},[e.disabled?i("div",[i("span",{staticStyle:{"vertical-align":"middle"}},[e._v(e._s(e.msg("subscribeToCreditPlugin")))])]):i("div",{staticClass:"d-inline-block w-100 "},[i("div",{staticClass:"w-100 d-flex"},[e.isQuantityVisible?i("div",{staticClass:"mr-2",style:{width:e.isSelectProductVisible?"30%":"100%","max-width":e.isSelectProductVisible?"150px":"100%"}},[i("crm-text-field",{ref:e.question.reference,staticClass:"crm-vuetify-selectandinput",attrs:{outlined:"",dense:"",type:"number",label:e.msg("quantity")+" de "+e.question.text,"label-max-length":45,placeholder:e.msg("quantity")+" de "+e.question.text,readonly:e.isReadOnlyPerm(e.question.reference)||e.isAllFieldsReadonly,required:e.isRequiredPerm(e.question.reference),error:!!e.requiredState.hasOwnProperty(e.computedReference)&&(null!=e.requiredState[e.computedReference]&&!e.requiredState[e.computedReference]),id:e.question.reference,color:null!=e.question.bkColor?e.question.bkColor:void 0},on:{input:e.updateQuantity},model:{value:e.tokenSelected.quantity,callback:function(t){e.$set(e.tokenSelected,"quantity",t)},expression:"tokenSelected.quantity"}})],1):e._e(),e.isSelectProductVisible?i("div",{staticClass:"w-100"},[i("v-menu",{staticStyle:{"max-height":"250px"},attrs:{"offset-y":"","close-on-content-click":!0},scopedSlots:e._u([{key:"activator",fn:function(t){var n=t.on,r=t.attrs;return[i("v-text-field",e._g(e._b({ref:e.question.reference,staticClass:"crm-vuetify-selectandinput mr-1",attrs:{value:e.selectedProductComputed,outlined:"",dense:"",required:e.isRequiredPerm(e.question.reference),id:e.question.reference,error:!!e.requiredState.hasOwnProperty(e.computedReference)&&(null!=e.requiredState[e.computedReference]&&!e.requiredState[e.computedReference]),readonly:"","append-icon":e.isAllFieldsReadonly?"":"mdi-menu-down",clearable:e.clearable},on:{"click:clear":function(t){e.productIdSelected=0,e.onSelectProduct()}},scopedSlots:e._u([{key:"label",fn:function(){return[e._v(" "+e._s(e.msg("product"))),e.isRequiredPerm(e.question.reference)?i("span",{staticStyle:{color:"orangered"}},[e._v(" *")]):e._e()]},proxy:!0}],null,!0)},"v-text-field",r,!1),e.isReadOnlyPerm(e.question.reference)||e.isAllFieldsReadonly||e.isSelectProductReadonly?{}:n))]}}],null,!1,2122681917)},[i("v-list",e._l(e.productsListOptions.filter(function(t){return t.id!==e.productIdSelected}),function(t){return i("v-list-item",{key:t.id,attrs:{link:""},on:{click:function(i){e.productIdSelected=t.id,e.onSelectProduct()}}},[i("v-list-item-title",{domProps:{textContent:e._s(t.brand+" - "+t.price+"€")}})],1)}),1)],1)],1):e._e(),e.tokenSelected.productId>0?i("div",{staticStyle:{width:"37px",height:"35px",padding:"8px","text-align":"center"}},[e.tokenSelected.isUsed?i("span",[e._v("🪙")]):i("span",[e._v("⌛")])]):e._e()]),i("div",{directives:[{name:"show",rawName:"v-show",value:!!e.requiredState.hasOwnProperty(e.computedReference)&&(null!=e.requiredState[e.computedReference]&&!e.requiredState[e.computedReference]),expression:"requiredState.hasOwnProperty(computedReference) ? (requiredState[computedReference] != null && !requiredState[computedReference]) : false"}],staticStyle:{"margin-top":"-6px","font-size":"80%",color:"#d92550"},attrs:{id:"input-live-feedback-"+e.question.reference}},[e._v(" "+e._s(e.question.text)+" "+e._s(e.msg("isMandatoryField"))+" ")]),e.hasInconsistentTokenState?i("div",{staticStyle:{"margin-top":"-6px","font-size":"80%",color:"#d92550"}},[e._v(" "+e._s(e.msg("inconsistentTokenState"))+" ")]):e._e()])]):e._e()},r=[],s=i(78676),o=i(54119),d=i(41034),u=(i(2008),i(50113),i(48980),i(74423),i(64346),i(48598),i(62062),i(15086),i(60739),i(18111),i(22489),i(20116),i(61701),i(13579),i(69112),i(33110),i(2892),i(40150),i(25843),i(79432),i(26099),i(78459),i(27495),i(90906),i(21699),i(71761),i(25440),i(95353)),c=i(75273),a=i(85700),l=i(85471),h=i(21771);const f={name:"tokenOrderForm",components:{crmTextField:h["default"],crmSelectAutoCompleteField:a.A},data:function(){return{isAllFieldsReadonly:!1,isSelectProductReadonly:!1,tokenSelected:{id:"0",productId:0,quantity:"",isUsed:!1,status:1},productIdSelected:0,listeners:{updateTokenIdInForms:function(){}},oldProductInCreditPrice:null,hasInconsistentTokenState:!1}},props:{question:Object,recordDataCenter:Object,rootObject:Object,form:Object,registerToken:{type:Number,required:!1,default:0},globalData:Array,fieldController:Object,requiredState:Object,row:String,disabled:Boolean},created:function(){var e=this;this.loadTokenSelected(),this.$root.$on("crm::tokenCart::updateTokenIdInForms",this.listeners.updateTokenIdInForms=function(){var t=e.getAllocatedTokens(),i=t.findIndex(function(t){return t.questionId===e.question.id&&(!e.row||t.row===e.row)});-1!==i&&(e.tokenSelected.id=t[i].tokenId,l["default"].set(e.getAllocatedTokens()[i],"statusFormUpdate",!0))})},beforeDestroy:function(){this.$root.$off("crm::tokenCart::updateTokenIdInForms",this.listeners.updateTokenIdInForms)},computed:(0,d.A)((0,d.A)((0,d.A)((0,d.A)((0,d.A)({},(0,u.L8)("forms",["getTypeQuestionEnum"])),(0,u.L8)("translator",["msg"])),(0,u.L8)("user",["myProfile"])),(0,u.L8)("creditConfig",["getCreditPriceByOrgIdFormatted","actionCreditTypeEnum","statusOrderEnum","getMyCreditConfig","getListActionCreditConfigByOrgId","getAllocatedTokens"])),{},{productsListOptions:function(){var e,t=(0,c.A)(this.getCreditPriceByOrgIdFormatted(this.myProfile.orgId)).products,i=null===(e=this.question.metadata)||void 0===e?void 0:e.creditProductList;return Array.isArray(i)&&0!==i.length?t.filter(function(e){return i.includes(e.id)}):t},selectedProductComputed:function(){var e=this,t=this.productsListOptions.find(function(t){return t.id===e.productIdSelected})||this.oldProductInCreditPrice;return t?t.brand+" - "+t.price+"€":null},clearable:function(){return!this.isReadOnlyPerm(this.question.reference)&&!(this.question.answerOptions&&this.question.answerOptions.some(function(e){return e.isDefault}))&&!this.isAllFieldsReadonly&&!this.isSelectProductReadonly&&this.productsListOptions.length>1},answerObject:function(){var e=this;return void 0!==this.row?this.question.formAnswer.find(function(t){return t.answerRow===e.row}):this.question.formAnswer},computedReference:function(){if(void 0!==this.row){var e=String(this.row).split("_p");return this.question.reference.split("_p").map(function(t,i){if(0===i)return t;if(/_r\d+$/.test(t))return t;var n=e[i-1];return n?t+"_r"+n:t}).join("_p")}return this.question.reference},useByValidScenario:function(){return this.question.formulaType&&"undefined"!==this.question.formulaType&&"BYSCENARIO"===this.question.formulaType&&this.question.doAction},useAutomatically:function(){return this.question.formulaType&&"undefined"!==this.question.formulaType&&"READONLY"===this.question.formulaType},isQuantityVisible:function(){var e,t,i="undefined"===typeof this.question.metadata.visibility;return i||1===(null===(e=this.question.metadata)||void 0===e?void 0:e.visibility)||3===(null===(t=this.question.metadata)||void 0===t?void 0:t.visibility)},isSelectProductVisible:function(){var e,t,i="undefined"===typeof this.question.metadata.visibility;return i||2===(null===(e=this.question.metadata)||void 0===e?void 0:e.visibility)||3===(null===(t=this.question.metadata)||void 0===t?void 0:t.visibility)}}),watch:{tokenSelected:{handler:function(e){this.answerObject.answer=JSON.stringify(e),this.setMapValue()},deep:!0},"answerObject.answer":{handler:function(){this.loadTokenSelected()},deep:!0},"question.doAction":{handler:function(){var e=this,t=this.getAllocatedTokens(),i=t.findIndex(function(t){return t.questionId===e.question.id&&(!e.row||t.row===e.row)});this.question.doAction?this.tokenSelected.productId>0&&this.tokenSelected.quantity>0&&!this.tokenSelected.isUsed&&(-1===i?this.addAllocatedToken():l["default"].set(this.getAllocatedTokens()[i],"statusOrder",this.statusOrderEnum.TO_USE.id)):i>-1&&l["default"].set(this.getAllocatedTokens()[i],"statusOrder",this.statusOrderEnum.IN_PROGRESS.id)}}},methods:(0,d.A)((0,d.A)((0,d.A)((0,d.A)({},(0,u.i0)("creditConfig",["getOneAvailableTokenForProduct","getTokenById"])),(0,u.
1i0)("products",{_getProductById:"get"})),(0,u.PY)("creditConfig",["allocateToken"])),{},{onSelectProduct:function(){if(0!==this.tokenSelected.productId&&this.$root.$emit("crm::tokenCart::removeAllocatedToken",this.question.id,this.row),this.productIdSelected<=0)return this.tokenSelected={id:"0",productId:0,quantity:"",isUsed:!1,status:1},this.answerObject.answer=JSON.stringify(this.tokenSelected),void this.setMapValue();this.addAllocatedToken()},addAllocatedToken:function(){var e=this,t=this.productsListOptions.find(function(t){return t.id===e.productIdSelected})||this.oldProductInCreditPrice,i=this.getMyCreditConfig&&this.getMyCreditConfig.exception;this.tokenSelected.id=i?"-1":"0",this.tokenSelected.isUsed=0,this.tokenSelected.productId=t.id,this.tokenSelected.status=this.statusOrderEnum.IN_PROGRESS.id,this.answerObject.answer=JSON.stringify(this.tokenSelected),this.setMapValue();var n={typeAction:4,tokenId:i?"-1":"0",newTokenId:null,tokenType:i?2:0,objectId:0,productId:t.id,productBrand:t.brand,productPrice:t.price,registerToken:0,processId:this.rootObject.objectGroup.processId,questionId:this.question.id,row:this.answerObject.answerRow,quantity:this.tokenSelected.quantity,statusOrder:(this.useByValidScenario||this.useAutomatically)&&this.tokenSelected.quantity&&this.tokenSelected.quantity>0?this.statusOrderEnum.TO_USE.id:this.statusOrderEnum.IN_PROGRESS.id,statusAvailability:"⌛",statusFormUpdate:!1};this.$root.$emit("crm::tokenCart::addAllocatedToken",n)},updateQuantity:function(){var e=this;if(this.question.formula&&""!==this.question.formula)this.applyFormula();else if(this.tokenSelected.productId<=0)return;var t=this.getAllocatedTokens(),i=t.findIndex(function(t){return t.questionId===e.question.id&&(!e.row||t.row===e.row)});-1===i?this.addAllocatedToken():(l["default"].set(this.getAllocatedTokens()[i],"quantity",this.tokenSelected.quantity),this.tokenSelected.quantity>0&&(this.useAutomatically||this.useByValidScenario)?l["default"].set(this.getAllocatedTokens()[i],"statusOrder",this.statusOrderEnum.TO_USE.id):l["default"].set(this.getAllocatedTokens()[i],"statusOrder",this.statusOrderEnum.IN_PROGRESS.id))},setMapValue:function(){this.$emit("updateMap",{question:this.question,row:this.row,customRef:this.computedReference})},isRequiredPerm:function(e){return 3===this.fieldController[e]},isReadOnlyPerm:function(e){return 2===this.fieldController[e]||2===this.fieldController["WIDGETINTEGRAL"]},loadTokenSelected:function(){var e,t=this,i=(null===(e=this.question.metadata)||void 0===e?void 0:e.defaultQuantity)||"";if(this.hasInconsistentTokenState=!1,this.answerObject.answer&&""!==this.answerObject.answer){this.tokenSelected=JSON.parse(this.answerObject.answer);var n=Number.parseInt(this.tokenSelected.id,10);this.tokenSelected.isUsed&&(Number.isNaN(n)||n<=0)&&(this.hasInconsistentTokenState=!0,console.error("tokenOrder: invalid state — isUsed=true with no valid token id",this.tokenSelected))}else this.tokenSelected={id:"0",productId:0,quantity:i,isUsed:!1,status:1},""!==i&&(this.isSelectProductReadonly=!0,this.applyFormula());this.tokenSelected.productId<=0&&1===this.productsListOptions.length?(this.productIdSelected=this.productsListOptions[0].id,this.onSelectProduct()):(this.productIdSelected=this.tokenSelected.productId,this.productIdSelected>0&&!this.productsListOptions.some(function(e){return e.id===t.productIdSelected})&&this._getProductById({id:this.productIdSelected}).then(function(e){if(e&&void 0!==(0,o.A)(e)&&e.id>0){var i;t.oldProductInCreditPrice=e;var n=parseFloat(t.oldProductInCreditPrice.sellPrice)||0,r=parseFloat(null===(i=t.oldProductInCreditPrice.taxList.find(function(e){return e.isDefault}))||void 0===i?void 0:i.taxPercent)||0,s=function(e){return!e||isNaN(e)?e:+(Math.round(e+"e+2")+"e-2")},d=s(n*r/100),u=s(n+d);t.oldProductInCreditPrice.price=u||0}})),this.tokenSelected.isUsed&&(this.answerObject.answerRow&&this.$emit("disableDeleteRow",this.answerObject.answerRow),this.isAllFieldsReadonly=!0)},applyFormula:function(){var e=this.question.formula.replace(/\s+/g,""),t=/productId=\(qte([<>!=]=?)(-?\d+(?:\.\d+)?)\?(-?\d+):(-?\d+)\)/i,i=e.match(t);if(i){var n=(0,s.A)(i,5),r=n[1],o=n[2],d=n[3],u=n[4],c=Number(this.tokenSelected.quantity),a=Number(o),l={">":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t}},h=l[r];if(h){var f=h(c,a);this.productIdSelected=Number(f?d:u),this.onSelectProduct()}else console.warn("tokenOrder: unsupported operator in formula:",r)}}})},p=f;var m=i(81656),S=(0,m.A)(p,n,r,!1,null,"b1766aba",null);const y=S.exports}}]);

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.