1"use strict";(self.webpackChunkvue_element_admin=self.webpackChunkvue_element_admin||[]).push([[35851],{2430:function(e,t,r){r.d(t,{A:function(){return o}});var s=r(45458),a=r(80296),i=r(38822),n={name:"ServiceRecord",components:{ServiceSum:function(){return r.e(8803).then(r.bind(r,8803))},ServiceDetails:function(){return Promise.all([r.e(14807),r.e(24812)]).then(r.bind(r,24812))},ServiceIssues:function(){return Promise.all([r.e(14807),r.e(24276),r.e(2576)]).then(r.bind(r,97562))},ServiceTasks:function(){return Promise.all([r.e(14807),r.e(16197),r.e(1029),r.e(76253),r.e(5284),r.e(8192),r.e(34870)]).then(r.bind(r,13842))},FilePanel:function(){return Promise.all([r.e(14807),r.e(51301)]).then(r.bind(r,26343))},DocsArticleButton:function(){return r.e(14807).then(r.bind(r,93898))},DocsVideoButton:function(){return r.e(20799).then(r.bind(r,20799))}},mixins:[r(19224).A],props:{serviceRecord:{type:Object,default:null,required:!1},errors:{type:Object,required:!0},loading:{type:Boolean,required:!1,default:!1}},data:function(){return{service_record_id:0,required_completion_date:!1,query_add_task:null,query_add_issue:null,select_task:[],select_issue:[],status_list:[],form:{vehicle_id:"",number_order:"",start_date:"",completion_date:"",vendor_id:"",comment:"",sync_label:[],counter_log:{primary:{value:null},secondary:{value:null}},tasks:[],sync_issue:[],discount:"percentage",tax:"percentage",sum_total:0}}},computed:{syncIssueError:function(){var e=Object.entries(this.errors||{}).filter(function(e){var t=(0,a.A)(e,1)[0];return"sync_issue"===t||t.startsWith("sync_issue.")}).flatMap(function(e){var t=(0,a.A)(e,2)[1];return Array.isArray(t)?t:[t]}).filter(function(e){return"string"==typeof e&&e.trim()});return(0,s.A)(new Set(e)).join(" ")}},created:function(){this.create()},mounted:function(){this.serviceRecord&&this.serviceRecord.id&&(this.service_record_id=this.serviceRecord.id)},methods:{updateIssuesForce:function(e){this.form.sync_issue=Object.assign([],e)},setServiceRecordId:function(e){this.service_record_id=e},showErrors:function(e,t){return(0,i.l)(e,t)},storeData:function(){var e=Object.assign({},this.form);this.splitTrash(e.tasks),this.$emit("save",e)},splitTrash:function(e){e.forEach(function(t,r){delete e[r].input1,delete e[r].input2,delete e[r].record_id})},create:function(){null!==this.serviceRecord?this.form=this.serviceRecord:(this.query_add_issue=Object.prototype.hasOwnProperty.call(this.$route.query,"issue_id")?Number(this.$route.query.issue_id):this.query_add_issue,this.query_add_task=Object.prototype.hasOwnProperty.call(this.$route.query,"task_id")?Number(this.$route.query.task_id):this.query_add_task,this.form.vehicle_id=Object.prototype.hasOwnProperty.call(this.$route.query,"vehicle_id")?Number(this.$route.query.vehicle_id):"")},syncData:function(e){this.form=Object.assign({},e,e)}}},o=(0,r(14486).A)(n,function(){var e=this,t=e._self._c;return t("div",{staticClass:"app-container"},[t("header-sticky",{attrs:{title:e.$t("route."+e.$route.meta.title)}},[t("template",{slot:"title"},[t("docs-article-button",{attrs:{data:"dobavlenie-servisnoj-zapisi"}}),e._v(" "),t("docs-video-button",{attrs:{data:"nier5qjVQEg"}})],1),e._v(" "),t("template",{slot:"prepend"},[t("el-button",{attrs:{loading:e.loading,type:"success",icon:"el-icon-plus",plain:""},on:{click:e.storeData}}
1,[e._v(e._s(e.$t("buttons.save")))])],1)],2),e._v(" "),t("el-card",[t("service-details",{attrs:{errors:e.errors,data:e.form},on:{data:e.syncData}})],1),e._v(" "),e.form.vehicle_id?t("el-card",{staticClass:"mt-15"},[t("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[t("span",[e._v(e._s(e.$t("issues.service_issues")))])]),e._v(" "),e.syncIssueError?t("el-alert",{staticClass:"mb-15",attrs:{title:e.syncIssueError,closable:!1,type:"error","show-icon":""}}):e._e(),e._v(" "),t("service-issues",{attrs:{add_issue:Number(e.query_add_issue),add_task:Number(e.query_add_task),vehicle_id:Number(e.form.vehicle_id),select_task:e.select_task,data:e.form},on:{updateIssues:e.updateIssuesForce,data:e.syncData,select_issue:function(t){e.select_issue=t}}})],1):e._e(),e._v(" "),e.form.vehicle_id?t("el-card",{staticClass:"mt-15"},[t("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[t("span",[e._v(e._s(e.$t("service.service_tasks")))])]),e._v(" "),e.select_issue?t("service-tasks",{attrs:{add_task:Number(e.query_add_task),data:e.form,select_issue:e.select_issue},on:{"add-guarantee-task":e.setGuaranteeToTask,data:e.syncData,select_task:function(t){e.select_task=t}}}):e._e()],1):e._e(),e._v(" "),e.form.vehicle_id?t("el-card",{staticClass:"mt-15"},[t("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[t("span",[e._v(e._s(e.$t("storage.total_cost")))])]),e._v(" "),t("service-sum",{attrs:{data:e.form},on:{sum_total:function(t){e.form.sum_total=t},data:e.syncData}})],1):e._e(),e._v(" "),e.form.vehicle_id?t("el-card",{staticClass:"mt-15"},[t("file-panel",{attrs:{entity_id:parseInt(e.service_record_id),photos:e.form.photos,docs:e.form.docs,module_name:"service_records"}})],1):e._e(),e._v(" "),e.form.vehicle_id?t("el-card",{staticClass:"mt-15"},[t("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[t("span",[e._v(e._s(e.$t("common.comment")))])]),e._v(" "),t("el-form",[t("el-form-item",[t("el-input",{attrs:{type:"textarea"},model:{value:e.form.comment,callback:function(t){e.$set(e.form,"comment",t)},expression:"form.comment"}})],1)],1)],1):e._e()],1)},[],!1,null,"03d64be7",null).exports},19224:function(e,t,r){var s=r(64467);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}t.A={data:function(){return{form:{task_guarantees:[]}}},methods:{setGuaranteeToTask:function(e){var t=e.task_id,r=e.guarantee,i=this.form.task_guarantees.find(function(e){return e.task_id===t});i?Number(r.mileage)<=0&&Number(r.month<=0)?this.removeGuaranteeFromTask(i.task_id):this.updateTaskGuarantee({task:i,guarantee:r}):this.form.task_guarantees.push(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){(0,s.A)(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({task_id:t},r))},updateTaskGuarantee:function(e){var t=e.task,r=e.guarantee;t.mileage=r.mileage,t.month=r.month,t.counter_type=r.counter_type},removeGuaranteeFromTask:function(e){this.form.task_guarantees=this.form.task_guarantees.filter(function(t){return t.task_id!==e})}}}},35851:function(e,t,r){r.r(t),r.d(t,{default:function(){return n}});var s=r(2430),a=r(339),i={name:"ServiceRecordCreate",components:{ServiceRecord:s.A},data:function(){return{errors:{},request:!1}},methods:{store:function(e){var t=this;this.request=!0,(0,a.M_)("service-records",e).then(function(e){t.$store.dispatch("afterSaveData").then(function(){t.$refs.serviceRecord.setServiceRecordId(e.data.id),setTimeout(function(){t.$router.push({name:"ServiceRecordList"}),t.$message.success(t.$t("common.saved")),t.$store.dispatch("delView",t.$router.currentRoute)},0)})}).catch(function(e){t.errors=e.data.errors||{},t.errors.transaction&&t.$alert(t.errors.transaction)}).finally(function(e){t.request=!1})}}},n=(0,r(14486).A)(i,function(){var e=this;return(0,e._self._c)("service-record",{ref:"serviceRecord",attrs:{loading:e.request,errors:e.errors},on:{save:function(t){return e.store(t)}}})},[],!1,null,"57455759",null).exports},38822:function(e,t,r){r.d(t,{l:function(){return a}});var s=r(82284);function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return t&&"object"===(0,s.A)(t)?t[e]&&t[e].length>0?t[e][0]:"":this.errors[e]&&this.errors[e].length>0?this.errors[e][0]:""}}}]);
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.