/home/techb158/ileadtechnology.com/SSM/public/js/transport/vehicle/document
Edit: /home/techb158/ileadtechnology.com/SSM/public/js/transport/vehicle/document/edit.js (15850B)
(window.webpackJsonp=window.webpackJsonp||[]).push([[362],{"p+nn":function(e,t,n){"use strict";n.r(t);var o={components:{vehicleDocumentForm:n("redg").a},data:function(){return{id:this.$route.params.id}},mounted:function(){helper.hasPermission("edit-vehicle-document")||(helper.notAccessibleMsg(),this.$router.push("/dashboard"))}},c=n("KHd+"),i=Object(c.a)(o,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"page-titles"},[n("div",{staticClass:"row"},[n("div",{staticClass:"col-12 col-sm-6"},[n("h3",{staticClass:"text-themecolor"},[e._v(e._s(e.trans("transport.edit_vehicle_document")))])]),e._v(" "),n("div",{staticClass:"col-12 col-sm-6"},[n("div",{staticClass:"action-buttons pull-right"},[n("button",{staticClass:"btn btn-info btn-sm",on:{click:function(t){return e.$router.push("/transport/vehicle/document")}}},[n("i",{staticClass:"fas fa-list"}),e._v(" "),n("span",{staticClass:"d-none d-sm-inline"},[e._v(e._s(e.trans("transport.vehicle_document")))])])])])])]),e._v(" "),n("div",{staticClass:"container-fluid"},[n("div",{staticClass:"card card-form"},[n("div",{staticClass:"card-body p-t-20"},[n("vehicle-document-form",{attrs:{id:e.id}})],1)])])])}),[],!1,null,null,null);t.default=i.exports},redg:function(e,t,n){"use strict";var o={components:{},props:["id"],data:function(){return{vehicleDocumentForm:new Form({title:"",vehicle_id:"",vehicle_document_type_id:"",date_of_expiry:"",description:"",policy_number:"",insurance_date:"",insurance_amount:"",insured_amount:"",insurance_company_name:"",insurance_agent_name:"",insurance_agent_contact_number:"",upload_token:""}),vehicles:[],selected_vehicle:null,selected_vehicle_document_type:null,vehicle_document_types:[],vehicle_document_type_details:[],clearAttachment:!1,expiry_date:!1,insurance_document:!1,module_id:""}},mounted:function(){this.vehicleDocumentForm.upload_token=this.$uuid.v4(),this.getPreRequisite(),this.id&&this.getDocument()},methods:{proceed:function(){this.id?this.updateDocument():this.storeDocument()},getPreRequisite:function(){var e=this,t=this.$loading.show();axios.get("/api/vehicle/document/pre-requisite").then((function(n){e.vehicles=n.vehicles,e.vehicle_document_types=n.vehicle_document_types,e.vehicle_document_type_details=n.vehicle_document_type_details,t.hide()})).catch((function(e){t.hide(),helper.showErrorMsg(e)}))},storeDocument:function(){var e=this,t=this.$loading.show();this.vehicleDocumentForm.post("/api/vehicle/document").then((function(n){toastr.success(n.message),e.clearAttachment=!e.clearAttachment,e.$emit("completed"),e.vehicleDocumentForm.upload_token=e.$uuid.v4(),e.selected_vehicle_document_type=null,e.selected_vehicle=null,t.hide()})).catch((function(e){t.hide(),helper.showErrorMsg(e)}))},getDocument:function(){var e=this,t=this.$loading.show();axios.get("/api/vehicle/document/"+this.id).then((function(n){e.vehicleDocumentForm.title=n.vehicle_document.title,e.vehicleDocumentForm.vehicle_id=n.vehicle_document.vehicle_id,e.vehicleDocumentForm.date_of_expiry=n.vehicle_document.date_of_expiry,e.vehicleDocumentForm.vehicle_document_type_id=n.vehicle_document.vehicle_document_type_id,e.selected_vehicle_document_type={id:n.vehicle_document.vehicle_document_type_id,name:n.vehicle_document.vehicle_document_type.name},e.selected_vehicle={id:n.vehicle_document.vehicle_id,name:n.vehicle_document.vehicle.name},e.vehicleDocumentForm.description=n.vehicle_document.description,e.vehicleDocumentForm.upload_token=n.vehicle_document.upload_token,e.expiry_date=!!n.vehicle_document.vehicle_document_type.has_expiry_date,e.insurance_document=!!n.vehicle_document.vehicle_document_type.is_insurance_document,e.module_id=n.vehicle_document.id;var o=n.vehicle_document.options&&n.vehicle_document.options.hasOwnProperty("insurance")?n.vehicle_document.options.insurance:{policy_number:"",insurance_date:"",insurance_amount:"",insured_amount:"",insurance_company_name:"",insurance_agent_name:"",insurance_agent_contact_number:""};e.vehicleDocumentForm.policy_number=o.policy_number,e.vehicleDocumentForm.insurance_date=o.insurance_date,e.vehicleDocumentForm.insurance_amount=o.insurance_amount,e.vehicleDocumentForm.insured_amount=o.insured_amount,e.vehicleDocumentForm.insurance_company_name=o.insurance_company_name,e.vehicleDocumentForm.insurance_agent_name=o.insurance_agent_name,e.vehicleDocumentForm.insurance_agent_contact_number=o.insurance_agent_contact_number,t.hide()})).catch((function(n){t.hide(),e.$router.push("/transport/vehicle/document")}))},updateDocument:function(){var e=this,t=this.$loading.show();this.vehicleDocumentForm.patch("/api/vehicle/document/"+this.id).then((function(n){toastr.success(n.message),e.$emit("completed"),t.hide(),e.$router.push("/transport/vehicle/document")})).catch((function(e){t.hide(),helper.showErrorMsg(e)}))},onDocumentTypeSelect:function(e){this.vehicleDocumentForm.vehicle_document_type_id=e.id;var t=this.vehicle_document_type_details.find((function(t){return t.id==e.id}));t.has_expiry_date?this.expiry_date=!0:this.expiry_date=!1,t.is_insurance_document?this.insurance_document=!0:this.insurance_document=!1},onVehicleSelect:function(e){this.vehicleDocumentForm.vehicle_id=e.id}},watch:{"vehicleDocumentForm.vehicle_document_type_id":function(e){e||(this.expiry_date=!1)}}},c=n("KHd+"),i=Object(c.a)(o,(function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("form",{on:{submit:function(t){return t.preventDefault(),e.proceed(t)},keydown:function(t){return e.vehicleDocumentForm.errors.clear(t.target.name)}}},[n("div",{staticClass:"row"},[n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle")))]),e._v(" "),n("v-select",{attrs:{label:"name",name:"vehicle_id",id:"vehicle_id",options:e.vehicles,placeholder:e.trans("general.select_one")},on:{select:e.onVehicleSelect,close:function(t){return e.vehicleDocumentForm.errors.clear("vehicle_id")},remove:function(t){e.vehicleDocumentForm.vehicle_id=""}},model:{value:e.selected_vehicle,callback:function(t){e.selected_vehicle=t},expression:"selected_vehicle"}},[e.vehicles.length?e._e():n("div",{staticClass:"multiselect__option",attrs:{slot:"afterList"},slot:"afterList"},[e._v("\n "+e._s(e.trans("general.no_option_found"))+"\n ")])]),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"vehicle_id"}})],1)]),e._v(" "),n("div",{staticClass:"col-12 col-sm-9"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_document_title")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.vehicleDocumentForm.title,expression:"vehicleDocumentForm.title"}],staticClass:"form-control",attrs:{type:"text",name:"title",placeholder:e.trans("transport.vehicle_document_title")},domProps:{value:e.vehicleDocumentForm.title},on:{input:function(t){t.target.composing||e.$set(e.vehicleDocumentForm,"title",t.target.value)}}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"title"}})],1)]),e._v(" "),n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_document_type")))]),e._v(" "),n("v-select",{attrs:{label:"name",name:"vehicle_document_type_id",id:"vehicle_document_type_id",options:e.vehicle_document_types,placeholder:e.trans("general.select_one")},on:{select:e.onDocumentTypeSelect,close:function(t){return e.vehicleDocumentForm.errors.clear("vehicle_document_type_id")},remove:function(t){e.vehicleDocumentForm.vehicle_document_type_id=""}},model:{value:e.selected_vehicle_document_type,callback:function(t){e.selected_vehicle_document_type=t},expression:"selected_vehicle_document_type"}},[e.vehicle_document_types.length?e._e():n("div",{staticClass:"multiselect__option",attrs:{slot:"afterList"},slot:"afterList"},[e._v("\n "+e._s(e.trans("general.no_option_found"))+"\n ")])]),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"vehicle_document_type_id"}})],1)]),e._v(" "),e.expiry_date?n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.date_of_expiry")))]),e._v(" "),n("datepicker",{attrs:{bootstrapStyling:!0,placeholder:e.trans("transport.date_of_expiry")},on:{selected:function(t){return e.vehicleDocumentForm.errors.clear("date_of_expiry")}},model:{value:e.vehicleDocumentForm.date_of_expiry,callback:function(t){e.$set(e.vehicleDocumentForm,"date_of_expiry",t)},expression:"vehicleDocumentForm.date_of_expiry"}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"date_of_expiry"}})],1)]):e._e(),e._v(" "),n("div",{staticClass:"col-12 col-sm-6"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_document_description")))]),e._v(" "),n("autosize-textarea",{attrs:{rows:"2",name:"description",placeholder:e.trans("vehicle.vehicle_document_description")},model:{value:e.vehicleDocumentForm.description,callback:function(t){e.$set(e.vehicleDocumentForm,"description",t)},expression:"vehicleDocumentForm.description"}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"description"}})],1)]),e._v(" "),e.insurance_document?[n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_policy_number")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.vehicleDocumentForm.policy_number,expression:"vehicleDocumentForm.policy_number"}],staticClass:"form-control",attrs:{type:"text",name:"policy_number",placeholder:e.trans("transport.vehicle_policy_number")},domProps:{value:e.vehicleDocumentForm.policy_number},on:{input:function(t){t.target.composing||e.$set(e.vehicleDocumentForm,"policy_number",t.target.value)}}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"policy_number"}})],1)]),e._v(" "),n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_insurance_date")))]),e._v(" "),n("datepicker",{attrs:{bootstrapStyling:!0,placeholder:e.trans("transport.vehicle_insurance_date")},on:{selected:function(t){return e.vehicleDocumentForm.errors.clear("insurance_date")}},model:{value:e.vehicleDocumentForm.insurance_date,callback:function(t){e.$set(e.vehicleDocumentForm,"insurance_date",t)},expression:"vehicleDocumentForm.insurance_date"}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"insurance_date"}})],1)]),e._v(" "),n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_insurance_amount")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.vehicleDocumentForm.insurance_amount,expression:"vehicleDocumentForm.insurance_amount"}],staticClass:"form-control",attrs:{type:"text",name:"insurance_amount",placeholder:e.trans("transport.vehicle_insurance_amount")},domProps:{value:e.vehicleDocumentForm.insurance_amount},on:{input:function(t){t.target.composing||e.$set(e.vehicleDocumentForm,"insurance_amount",t.target.value)}}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"insurance_amount"}})],1)]),e._v(" "),n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_insured_amount")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.vehicleDocumentForm.insured_amount,expression:"vehicleDocumentForm.insured_amount"}],staticClass:"form-control",attrs:{type:"text",name:"insured_amount",placeholder:e.trans("transport.vehicle_insured_amount")},domProps:{value:e.vehicleDocumentForm.insured_amount},on:{input:function(t){t.target.composing||e.$set(e.vehicleDocumentForm,"insured_amount",t.target.value)}}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"insured_amount"}})],1)]),e._v(" "),n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_insurance_company_name")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.vehicleDocumentForm.insurance_company_name,expression:"vehicleDocumentForm.insurance_company_name"}],staticClass:"form-control",attrs:{type:"text",name:"insurance_company_name",placeholder:e.trans("transport.vehicle_insurance_company_name")},domProps:{value:e.vehicleDocumentForm.insurance_company_name},on:{input:function(t){t.target.composing||e.$set(e.vehicleDocumentForm,"insurance_company_name",t.target.value)}}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"insurance_company_name"}})],1)]),e._v(" "),n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_insurance_agent_name")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.vehicleDocumentForm.insurance_agent_name,expression:"vehicleDocumentForm.insurance_agent_name"}],staticClass:"form-control",attrs:{type:"text",name:"insurance_agent_name",placeholder:e.trans("transport.vehicle_insurance_agent_name")},domProps:{value:e.vehicleDocumentForm.insurance_agent_name},on:{input:function(t){t.target.composing||e.$set(e.vehicleDocumentForm,"insurance_agent_name",t.target.value)}}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"insurance_agent_name"}})],1)]),e._v(" "),n("div",{staticClass:"col-12 col-sm-3"},[n("div",{staticClass:"form-group"},[n("label",{attrs:{for:""}},[e._v(e._s(e.trans("transport.vehicle_insurance_agent_contact_number")))]),e._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:e.vehicleDocumentForm.insurance_agent_contact_number,expression:"vehicleDocumentForm.insurance_agent_contact_number"}],staticClass:"form-control",attrs:{type:"text",name:"insurance_agent_contact_number",placeholder:e.trans("transport.vehicle_insurance_agent_contact_number")},domProps:{value:e.vehicleDocumentForm.insurance_agent_contact_number},on:{input:function(t){t.target.composing||e.$set(e.vehicleDocumentForm,"insurance_agent_contact_number",t.target.value)}}}),e._v(" "),n("show-error",{attrs:{"form-name":e.vehicleDocumentForm,"prop-name":"insurance_agent_contact_number"}})],1)])]:e._e()],2),e._v(" "),n("div",{staticClass:"row"},[n("div",{staticClass:"col-12 col-sm-3"},[n("label",[e._v(" ")]),e._v(" "),n("div",{staticClass:"form-group"},[n("file-upload-input",{attrs:{"button-text":e.trans("general.upload_document"),token:e.vehicleDocumentForm.upload_token,module:"vehicle_document","clear-file":e.clearAttachment,"module-id":e.module_id}})],1)])]),e._v(" "),n("div",{staticClass:"card-footer text-right"},[n("router-link",{directives:[{name:"show",rawName:"v-show",value:e.id,expression:"id"}],staticClass:"btn btn-danger waves-effect waves-light ",attrs:{to:"/transport/vehicle/document"}},[e._v(e._s(e.trans("general.cancel")))]),e._v(" "),e.id?e._e():n("button",{staticClass:"btn btn-danger waves-effect waves-light ",attrs:{type:"button"},on:{click:function(t){return e.$emit("cancel")}}},[e._v(e._s(e.trans("general.cancel")))]),e._v(" "),n("button",{staticClass:"btn btn-info waves-effect waves-light",attrs:{type:"submit"}},[e.id?n("span",[e._v(e._s(e.trans("general.update")))]):n("span",[e._v(e._s(e.trans("general.save")))])])],1)])])}),[],!1,null,null,null);t.a=i.exports}}]);
//# sourceMappingURL=edit.js.map?id=d4387507d43581d58263