(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-38f13c56"],{"14c3":function(t,e,a){"use strict";var i=a("c65b"),n=a("825a"),r=a("1626"),o=a("c6b6"),s=a("9263"),l=TypeError;t.exports=function(t,e){var a=t.exec;if(r(a)){var c=i(a,t,e);return null!==c&&n(c),c}if("RegExp"===o(t))return i(s,t,e);throw new l("RegExp#exec called on incompatible receiver")}},"466d":function(t,e,a){"use strict";var i=a("c65b"),n=a("d784"),r=a("825a"),o=a("861d"),s=a("50c4"),l=a("577e"),c=a("1d80"),u=a("dc4a"),d=a("8aa5"),p=a("14c3");n("match",(function(t,e,a){return[function(e){var a=c(this),n=o(e)?u(e,t):void 0;return n?i(n,e,a):new RegExp(e)[t](l(a))},function(t){var i=r(this),n=l(t),o=a(e,i,n);if(o.done)return o.value;if(!i.global)return p(i,n);var c=i.unicode;i.lastIndex=0;var u,f=[],m=0;while(null!==(u=p(i,n))){var b=l(u[0]);f[m]=b,""===b&&(i.lastIndex=d(n,s(i.lastIndex),c)),m++}return 0===m?null:f}]}))},7164:function(t,e,a){"use strict";a("7684")},7684:function(t,e,a){},"7db0":function(t,e,a){"use strict";var i=a("23e7"),n=a("b727").find,r=a("44d2"),o="find",s=!0;o in[]&&Array(1)[o]((function(){s=!1})),i({target:"Array",proto:!0,forced:s},{find:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),r(o)},"8aa5":function(t,e,a){"use strict";var i=a("6547").charAt;t.exports=function(t,e,a){return e+(a?i(t,e).length:1)}},"95a8":function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t._self._c;return e("div",{staticClass:"main-content"},[e("breadcumb",{attrs:{page:"Tracking Distribusi",folder:"Tracking Distribusi",link:"/app/campaign-distribution-trackings"}}),e("b-row",[e("b-col",{attrs:{md:"12"}},[e("b-card",{staticClass:"mb-3"},[e("b-overlay",{attrs:{show:t.loading,rounded:"sm"}},[e("b-form-group",{staticClass:"mb-3",attrs:{label:"Projek","label-for":"input-5"}},[t._v(" "+t._s(t.form.campaign?t.form.campaign.wakaf_name:"")+" ")]),e("b-form-group",{staticClass:"mb-3",attrs:{label:"Nama Lokasi Distribusi","label-for":"input-1"}},[t._v(" "+t._s(t.form.drop_point_name)+" ")]),e("b-form-group",{staticClass:"mb-3",attrs:{label:"Titik Lokasi Distribusi","label-for":"input-1"}},[e("div",{staticStyle:{position:"relative"},attrs:{id:"find-drop-point-map"}},[e("div",{ref:"mapContainer",staticStyle:{height:"300px"},attrs:{id:"map"}})])]),e("b-form-group",{staticClass:"mb-3",attrs:{label:"Estimasi waktu tiba","label-for":"input-2"}},[t._v(" "+t._s(t.form.estimation_date?t.$moment(t.form.estimation_date).locale("id").format("DD-MM-YYYY"):"-")+" ")]),t.form.wakaf_distribution_tracking_id?e("div",[e("h3",[t._v("Detail Tracking")]),e("TrackingDetails",{attrs:{trackingId:t.form.wakaf_distribution_tracking_id,trackingStatus:t.form.distribution_status}})],1):t._e()],1)],1)],1)],1)],1)},n=[],r=a("c7eb"),o=a("1da1"),s=(a("99af"),a("d81d"),a("e9f5"),a("ab43"),a("d3b7"),a("e192")),l=a.n(s),c=function(){var t=this,e=t._self._c;return e("div",{staticClass:"tracking-details"},["closed"!==t.trackingStatus?e("b-button",{staticClass:"mb-3",attrs:{variant:"primary"},on:{click:t.showAddModal}},[t._v("Tambah")]):t._e(),e("b-table",{attrs:{id:"table-list-details",items:t.trackingDetails,fields:t.fields,responsive:"sm",busy:t.isBusy,"show-empty":""},scopedSlots:t._u([{key:"cell(detail_location_name)",fn:function(a){return[e("a",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.showDetailModal(a.item)}}},[t._v(" "+t._s(a.item.detail_location_name)+" ")])]}},{key:"cell(updated_at)",fn:function(e){return[t._v(" "+t._s(t.$moment(e.item.updated_at).format("DD-MM-YYYY hh:ss"))+" ")]}},{key:"cell(actions)",fn:function(a){return[e("div",{class:{disabled:"closed"===t.trackingStatus},staticStyle:{position:"relative"}},["closed"===t.trackingStatus?e("div",{staticStyle:{position:"absolute",width:"100%",height:"100%","background-color":"#000",opacity:"0","z-index":"2"}}):t._e(),e("a",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],attrs:{title:"Edit"},on:{click:function(e){return e.preventDefault(),t.showEditModal(a.item)}}},[e("i",{staticClass:"i-Eraser-2 text-25 text-success mr-2"})]),e("a",{directives:[{name:"b-tooltip",rawName:"v-b-tooltip.hover",modifiers:{hover:!0}}],attrs:{href:"#",title:"Hapus"},on:{click:function(e){return e.preventDefault(),t.handleDelete(a.item.wakaf_distribution_tracking_detail_id)}}},[e("i",{staticClass:"i-Close-Window text-25 text-danger"})])])]}}])}),e("b-modal",{attrs:{"hide-footer":"",title:t.isEditMode?"Edit Detail Tracking":"Add New Detail Tracking"},on:{hide:t.resetForm},model:{value:t.isModalVisible,callback:function(e){t.isModalVisible=e},expression:"isModalVisible"}},[e("b-form",{on:{submit:function(e){e.preventDefault(),t.isEditMode?t.updateTracking():t.addTracking()}}},[e("b-form-group",{attrs:{label:"Status *","label-for":"status"}},[e("b-form-select",{attrs:{id:"status",options:t.statusOptions,required:""},model:{value:t.form.detail_status,callback:function(e){t.$set(t.form,"detail_status",e)},expression:"form.detail_status"}})],1),e("b-form-group",{attrs:{label:"Nama Lokasi *","label-for":"location-name"}},[e("b-form-input",{attrs:{id:"location-name",required:"",placeholder:"Enter nama lokasi"},model:{value:t.form.detail_location_name,callback:function(e){t.$set(t.form,"detail_location_name",e)},expression:"form.detail_location_name"}})],1),e("b-form-group",{attrs:{label:"Koordinat Lokasi"}},[e("div",{staticStyle:{position:"relative"},attrs:{id:"find-drop-point-map"}},[e("b-btn",{staticClass:"my-location-button",on:{click:function(e){return e.preventDefault(),t.accessMyLocation.apply(null,arguments)}}},[e("i",{staticClass:"nav-icon i-Target"})]),e("div",{ref:"geocoderContainer",attrs:{id:"geocoder"}}),e("div",{ref:"mapContainer",staticStyle:{height:"300px",width:"100%"},attrs:{id:"map"}})],1)]),e("b-form-group",{attrs:{label:"Note","label-for":"note"}},[e("b-form-textarea",{attrs:{id:"note",placeholder:"Ketikkan catatan"},model:{value:t.form.note,callback:function(e){t.$set(t.form,"note",e)},expression:"form.note"}})],1),e("b-form-group",{attrs:{label:"Foto/Video","label-for":"gallery"}},t._l(t.form.galleries,(function(a,i){return e("div",{key:i},[a.id&&a.value?e("div",{staticStyle:{position:"relative"}},[e("div",{staticClass:"gallery"},[a.value?e("a",{staticStyle:{position:"relative"},attrs:{href:a.value,target:"_blank"}},[e("input",{attrs:{type:"hidden",id:"gallery_use_old_value_".concat(i),value:"1"}}),"photo"===a.type?e("img",{attrs:{src:a.value}}):e("img",{attrs:{src:t.getYouTubeThumbnail(a.value)}}),"video"===a.type?e("span",{staticStyle:{position:"absolute",left:"0px",right:"0px",padding:"20px"}},[e("svg",{staticStyle:{opacity:"0.75"},attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"#fff"}},[e("path",{attrs:{d:"M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c7.6-4.2 16.8-4.1 24.3 .5l144 88c7.1 4.4 11.5 12.1 11.5 20.5s-4.4 16.1-11.5 20.5l-144 88c-7.4 4.5-16.7 4.7-24.3 .5s-12.3-12.2-12.3-20.9l0-176c0-8.7 4.7-16.7 12.3-20.9z"}})])]):t._e()]):t._e()]),e("b-button",{staticClass:"mt-1",staticStyle:{position:"absolute",right:"0px",top:"13px",padding:"5px","font-size":"12px"},attrs:{variant:"danger",size:"small"},on:{click:function(t){a.value=null,a.id=null}}},[t._v("Hapus")])],1):e("div",[e("b-row",{staticClass:"mb-1"},[e("b-col",{attrs:{cols:"3"}},[e("b-form-radio",{attrs:{name:"gallery_type_".concat(i),value:"photo"},on:{click:function(t){a.value=null}},model:{value:a.type,callback:function(e){t.$set(a,"type",e)},expression:"gallery.type"}},[t._v("Photo")])],1),e("b-col",[e("b-form-radio",{attrs:{name:"gallery_type_".concat(i),value:"video"},on:{click:function(t){a.value=null}},model:{value:a.type,callback:function(e){t.$set(a,"type",e)},expression:"gallery.type"}},[t._v("Video")])],1)],1),"photo"===a.type?e("input",{attrs:{id:"gallery_file_".concat(i),type:"file",accept:"image/png, image/jpeg, image/jpg"}}):e("b-input",{attrs:{placeholder:"URL embed youtube"},model:{value:a.value,callback:function(e){t.$set(a,"value",e)},expression:"gallery.value"}})],1),e("hr",{staticClass:"mt-1 mb-1"})])})),0),e("b-button",{attrs:{type:"submit",disabled:t.loading,variant:"primary"}},[t._v(t._s(t.isEditMode?"Ubah":"Simpan"))])],1)],1),e("b-modal",{attrs:{"hide-footer":"",title:"Detail Tracking"},model:{value:t.isDetailModalVisible,callback:function(e){t.isDetailModalVisible=e},expression:"isDetailModalVisible"}},[e("div",[e("p",{staticClass:"mb-1"},[e("strong",[t._v("Nama Lokasi:")]),t._v(" "+t._s(t.form.detail_location_name))]),e("div",{ref:"mapDetailContainer",staticStyle:{height:"300px",width:"100%"},attrs:{id:"map-detail"}}),e("p",{staticClass:"mt-2 mb-2"},[e("strong",[t._v("Status:")]),t._v(" "+t._s(t.form.detail_status))]),e("p",[e("strong",[t._v("Note:")]),t._v(" "+t._s(t.form.note))]),e("p",[e("strong",[t._v("Galleri:")])]),e("div",{staticClass:"gallery"},t._l(t.form.galleries,(function(a,i){return e("div",{key:i},[a.value?e("a",{staticStyle:{position:"relative"},attrs:{href:a.value,target:"_blank"}},["photo"===a.type?e("img",{attrs:{src:a.value}}):e("img",{attrs:{src:t.getYouTubeThumbnail(a.value)}}),"video"===a.type?e("span",{staticStyle:{position:"absolute",left:"0px",right:"0px",padding:"20px"}},[e("svg",{staticStyle:{opacity:"0.75"},attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",fill:"#fff"}},[e("path",{attrs:{d:"M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c7.6-4.2 16.8-4.1 24.3 .5l144 88c7.1 4.4 11.5 12.1 11.5 20.5s-4.4 16.1-11.5 20.5l-144 88c-7.4 4.5-16.7 4.7-24.3 .5s-12.3-12.2-12.3-20.9l0-176c0-8.7 4.7-16.7 12.3-20.9z"}})])]):t._e()]):t._e()])})),0)])])],1)},u=[],d=a("5530"),p=(a("7db0"),a("f665"),a("7d54"),a("b680"),a("ac1f"),a("466d"),a("159b"),a("885b")),f=a.n(p),m=(a("ac6d"),a("c307"),{props:["trackingId","trackingStatus"],data:function(){return{isBusy:!1,loading:!1,isModalVisible:!1,isEditMode:!1,isDetailModalVisible:!1,form:{wakaf_distribution_tracking_detail_id:null,detail_location_name:"",detail_latitude:-6.176132,detail_longitude:106.822864,detail_status:"",galleries:[],note:""},fields:[{key:"detail_location_name",label:"Nama Lokasi"},{key:"detail_status",label:"Status"},{key:"note",label:"Note"},{key:"updated_at",label:"Waktu Update"},{key:"actions",label:"Actions"}],map:null,marker:null,mapboxToken:"pk.eyJ1IjoiYWZhbmRpcHJhdGFtYTE5OTciLCJhIjoiY2xsb3hibHh4MDBrbjNxcGlxMWY1Zm9lbiJ9.kRfS4Zu01j7ILetylPziTQ",trackingDetails:[]}},watch:{trackingId:function(){this.fetchTrackingDetails()}},mounted:function(){this.fetchTrackingDetails()},computed:{statusOptions:function(){return[{value:"Persiapan",text:"Persiapan",disabled:!1},{value:"Pengiriman",text:"Pengiriman",disabled:!this.trackingDetails.find((function(t){return"Persiapan"===t.detail_status}))},{value:"Tiba dilokasi",text:"Tiba dilokasi",disabled:!this.trackingDetails.find((function(t){return"Persiapan"===t.detail_status}))||!this.trackingDetails.find((function(t){return"Pengiriman"===t.detail_status}))}]}},methods:{getNameFromURL:function(t){return t.substring(t.lastIndexOf("/")+1)},getYouTubeThumbnail:function(t){var e=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,a=t.match(e);if(a&&a[1]){var i=a[1];return"https://img.youtube.com/vi/".concat(i,"/hqdefault.jpg")}return null},onSelectGallery:function(t,e){null!==t.target.files&&""!==t.target.files&&(e.value=t.target.files[0])},accessMyLocation:function(){var t=this;navigator.geolocation?navigator.geolocation.getCurrentPosition((function(e){var a=e.coords,i=a.latitude,n=a.longitude;t.map.flyTo({center:[n,i],essential:!0,zoom:14}),t.marker.setLngLat([n,i]),t.latitude=i.toFixed(6),t.longitude=n.toFixed(6)}),(function(t){console.error("Error accessing location: ",t),alert("Unable to access your location. Please make sure location services are enabled.")})):alert("Geolocation is not supported by your browser.")},showAddModal:function(){var t=this;return Object(o["a"])(Object(r["a"])().mark((function e(){return Object(r["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.resetForm(),t.isEditMode=!1,t.isModalVisible=!0,e.next=5,t.$nextTick();case 5:setTimeout((function(){t.initializeMap()}),500);case 6:case"end":return e.stop()}}),e)})))()},showEditModal:function(t){var e=this;return Object(o["a"])(Object(r["a"])().mark((function a(){return Object(r["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return e.isEditMode=!0,e.form=Object(d["a"])({},t),e.form.galleries=[{id:t.galleries[0]?1:null,type:t.galleries[0]?t.galleries[0].type:"photo",value:t.galleries[0]?t.galleries[0].value:null},{id:t.galleries[1]?2:null,type:t.galleries[1]?t.galleries[1].type:"photo",value:t.galleries[1]?t.galleries[1].value:null},{id:t.galleries[2]?3:null,type:t.galleries[2]?t.galleries[2].type:"photo",value:t.galleries[2]?t.galleries[2].value:null}],e.isModalVisible=!0,a.next=6,e.$nextTick();case 6:setTimeout((function(){e.initializeMap(t.detail_latitude,t.detail_longitude)}),500);case 7:case"end":return a.stop()}}),a)})))()},showDetailModal:function(t){var e=this;return Object(o["a"])(Object(r["a"])().mark((function a(){return Object(r["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return e.form=Object(d["a"])({},t),e.isDetailModalVisible=!0,a.next=4,e.$nextTick();case 4:setTimeout((function(){e.initializeMapDetail(t.detail_latitude,t.detail_longitude)}),500);case 5:case"end":return a.stop()}}),a)})))()},handleDelete:function(t){var e=this;return Object(o["a"])(Object(r["a"])().mark((function a(){return Object(r["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,e.$http.delete("".concat("https://orchestrator.bwa.id/api/v1/","distribution-tracking-details/").concat(t),{headers:{Authorization:"Bearer ".concat(e.$store.getters["accessToken"])}});case 3:e.$store.dispatch("success","Detail berhasil dihapus"),e.fetchTrackingDetails(),a.next=10;break;case 7:a.prev=7,a.t0=a["catch"](0),e.$store.dispatch("error",a.t0);case 10:case"end":return a.stop()}}),a,null,[[0,7]])})))()},initializeMap:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-6.176132,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:106.822864;l.a.accessToken=this.mapboxToken,this.map=new l.a.Map({container:this.$refs.mapContainer,style:"mapbox://styles/mapbox/streets-v11",center:[a,e],zoom:12}),this.marker=new l.a.Marker({draggable:!0}).setLngLat([a,e]).addTo(this.map),this.marker.on("dragend",(function(){var e=t.marker.getLngLat(),a=e.lng,i=e.lat;t.form.detail_latitude=i,t.form.detail_longitude=a}));var i=new f.a({accessToken:this.mapboxToken,mapboxgl:l.a,marker:!1,placeholder:"Cari alamat...",countries:"ID"});this.$refs.geocoderContainer.appendChild(i.onAdd(this.map)),i.on("result",(function(e){var a=e.result.geometry.coordinates;t.map.flyTo({center:a,essential:!0,zoom:14}),t.marker.setLngLat(a),t.form.detail_latitude=a[1].toFixed(6),t.form.detail_longitude=a[0].toFixed(6)}))},initializeMapDetail:function(t,e){l.a.accessToken=this.mapboxToken,this.mapDetail=new l.a.Map({container:this.$refs.mapDetailContainer,style:"mapbox://styles/mapbox/streets-v11",center:[e,t],zoom:12}),(new l.a.Marker).setLngLat([e,t]).addTo(this.mapDetail)},addTracking:function(){var t=this;return Object(o["a"])(Object(r["a"])().mark((function e(){var a,i;return Object(r["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.loading=!0,e.prev=1,a=new FormData,a.append("wakaf_distribution_tracking_id",t.trackingId),a.append("detail_location_name",t.form.detail_location_name),a.append("detail_latitude",t.form.detail_latitude),a.append("detail_longitude",t.form.detail_longitude),a.append("detail_status",t.form.detail_status),i=0,t.form.galleries.forEach((function(t,e){"photo"===t.type&&document.querySelector("#gallery_file_".concat(e)).files.length>0?(a.append("galleries[".concat(i,"][type]"),"photo"),a.append("galleries[".concat(i,"][value]"),document.querySelector("#gallery_file_".concat(e)).files[0]),i++):"video"===t.type&&t.value&&t.value.length>5&&(a.append("galleries[".concat(i,"][type]"),"video"),a.append("galleries[".concat(i,"][value]"),t.value),i++)})),t.form.note&&t.form.note.length>3&&a.append("note",t.form.note),e.next=13,t.$http.post("".concat("https://orchestrator.bwa.id/api/v1/","distribution-tracking-details"),a,{headers:{Authorization:"Bearer ".concat(t.$store.getters["accessToken"])}});case 13:t.$store.dispatch("success","Detail tracking berhasil ditambahkan"),t.isModalVisible=!1,t.fetchTrackingDetails(),t.resetForm(),e.next=23;break;case 19:e.prev=19,e.t0=e["catch"](1),console.log(e.t0),t.$store.dispatch("error",e.t0);case 23:return e.prev=23,t.loading=!1,e.finish(23);case 26:case"end":return e.stop()}}),e,null,[[1,19,23,26]])})))()},updateTracking:function(){var t=this;return Object(o["a"])(Object(r["a"])().mark((function e(){var a,i;return Object(r["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.loading=!0,e.prev=1,a=new FormData,a.append("_method","PATCH"),a.append("wakaf_distribution_tracking_id",t.trackingId),a.append("detail_location_name",t.form.detail_location_name),a.append("detail_latitude",t.form.detail_latitude),a.append("detail_longitude",t.form.detail_longitude),a.append("detail_status",t.form.detail_status),t.form.note&&t.form.note.length>3&&a.append("note",t.form.note),i=0,t.form.galleries.forEach((function(t,e){document.querySelector("#gallery_use_old_value_".concat(e))?(a.append("galleries[".concat(i,"][type]"),t.type),a.append("galleries[".concat(i,"][value]"),"old-value"),i++):"photo"===t.type&&document.querySelector("#gallery_file_".concat(e)).files.length>0?(a.append("galleries[".concat(i,"][type]"),"photo"),a.append("galleries[".concat(i,"][value]"),document.querySelector("#gallery_file_".concat(e)).files[0]),i++):"video"===t.type&&t.value&&t.value.length>5&&(a.append("galleries[".concat(i,"][type]"),"video"),a.append("galleries[".concat(i,"][value]"),t.value),i++)})),e.next=14,t.$http.post("".concat("https://orchestrator.bwa.id/api/v1/","distribution-tracking-details/").concat(t.form.wakaf_distribution_tracking_detail_id),a,{headers:{Authorization:"Bearer ".concat(t.$store.getters["accessToken"])}});case 14:t.$store.dispatch("success","Detail tracking berhasil diubah"),t.isModalVisible=!1,t.fetchTrackingDetails(),t.resetForm(),e.next=24;break;case 20:e.prev=20,e.t0=e["catch"](1),console.log(e.t0),t.$store.dispatch("error",e.t0);case 24:return e.prev=24,t.loading=!1,e.finish(24);case 27:case"end":return e.stop()}}),e,null,[[1,20,24,27]])})))()},fetchTrackingDetails:function(){var t=this;return Object(o["a"])(Object(r["a"])().mark((function e(){var a;return Object(r["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.isBusy=!0,e.prev=1,e.next=4,t.$http.get("".concat("https://orchestrator.bwa.id/api/v1/","distribution-tracking-details?limit=1000&wakaf_distribution_tracking_id=").concat(t.trackingId),{headers:{Authorization:"Bearer ".concat(t.$store.getters["accessToken"])}});case 4:a=e.sent,t.trackingDetails=a.data.data,e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](1),t.$store.dispatch("error",e.t0);case 11:return e.prev=11,t.isBusy=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[1,8,11,14]])})))()},resetForm:function(){this.form={id:null,galleries:[{id:null,type:"photo",value:null},{id:null,type:"photo",value:null},{id:null,type:"photo",value:null}],detail_location_name:"",detail_latitude:-6.176132,detail_longitude:106.822864,detail_status:"",note:""}}}}),b=m,g=(a("7164"),a("2877")),h=Object(g["a"])(b,c,u,!1,null,null,null),_=h.exports,v={components:{TrackingDetails:_},data:function(){return{mapboxToken:"pk.eyJ1IjoiYWZhbmRpcHJhdGFtYTE5OTciLCJhIjoiY2xsb3hibHh4MDBrbjNxcGlxMWY1Zm9lbiJ9.kRfS4Zu01j7ILetylPziTQ",form:{wakaf_distribution_tracking_id:null,campaign:null,drop_point_name:null,drop_point_latitude:-6.176132,drop_point_longitude:106.822864,estimation_date:null,distribution_status:null,published:null},loading:!1}},watch:{"$route.params.uuid":function(t){void 0!==t?(this.form.wakaf_distribution_tracking_id=t,this.getDetail()):this.resetForm()}},mounted:function(){void 0!==this.$route.params.uuid&&(this.form.wakaf_distribution_tracking_id=this.$route.params.uuid,this.getDetail())},methods:{doClose:function(){var t=this;return Object(o["a"])(Object(r["a"])().mark((function e(){return Object(r["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!confirm("Anda yakin akan menutup Tracking Distribusi Ini?")){e.next=11;break}return e.prev=1,e.next=4,t.$http.patch("".concat("https://orchestrator.bwa.id/api/v1/","campaign-distribution-trackings/").concat(t.$route.params.uuid),{distribution_status:"closed"},{headers:{Authorization:"Bearer ".concat(t.$store.getters["accessToken"])}});case 4:t.$store.dispatch("success","Tracking Distribusi berhasil ditutup"),t.form.distribution_status="closed",e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](1),t.$store.dispatch("error",e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})))()},initializeMap:function(){l.a.accessToken=this.mapboxToken,this.map=new l.a.Map({container:this.$refs.mapContainer,style:"mapbox://styles/mapbox/streets-v11",center:[this.form.drop_point_longitude,this.form.drop_point_latitude],zoom:12}),this.marker=new l.a.Marker({draggable:!1}).setLngLat([this.form.drop_point_longitude,this.form.drop_point_latitude]).addTo(this.map)},resetForm:function(){this.form.wakaf_distribution_tracking_id=null,this.form.campaign=null,this.form.drop_point_name=null,this.form.drop_point_latitude=null,this.form.drop_point_longitude=null,this.form.estimation_date=null,this.form.distribution_status=null,this.form.published=null},getDetail:function(){var t=this;this.isLoading=!0,this.$http.get("".concat("https://orchestrator.bwa.id/api/v1/","campaign-distribution-trackings/").concat(this.$route.params.uuid)).then((function(e){t.form.wakaf_distribution_tracking_id=e.data.wakaf_distribution_tracking_id,t.form.campaign=e.data.campaign,t.form.drop_point_name=e.data.drop_point_name,t.form.drop_point_latitude=e.data.drop_point_latitude,t.form.drop_point_longitude=e.data.drop_point_longitude,t.form.estimation_date=e.data.estimation_date,t.form.distribution_status=e.data.distribution_status,t.form.published=e.data.published,t.initializeMap(),t.isLoading=!1})).catch((function(e){t.isLoading=!1,t.$store.dispatch("error",e),"undefined"!==typeof e&&"undefined"!==typeof e.response&&"undefined"!==typeof e.response.status&&e.response.status}))}}},k=v,y=(a("b6b7"),Object(g["a"])(k,i,n,!1,null,"cff95c4e",null));e["default"]=y.exports},b6b7:function(t,e,a){"use strict";a("d959")},d784:function(t,e,a){"use strict";a("ac1f");var i=a("c65b"),n=a("cb2d"),r=a("9263"),o=a("d039"),s=a("b622"),l=a("9112"),c=s("species"),u=RegExp.prototype;t.exports=function(t,e,a,d){var p=s(t),f=!o((function(){var e={};return e[p]=function(){return 7},7!==""[t](e)})),m=f&&!o((function(){var e=!1,a=/a/;return"split"===t&&(a={},a.constructor={},a.constructor[c]=function(){return a},a.flags="",a[p]=/./[p]),a.exec=function(){return e=!0,null},a[p](""),!e}));if(!f||!m||a){var b=/./[p],g=e(p,""[t],(function(t,e,a,n,o){var s=e.exec;return s===r||s===u.exec?f&&!o?{done:!0,value:i(b,e,a,n)}:{done:!0,value:i(t,a,e,n)}:{done:!1}}));n(String.prototype,t,g[0]),n(u,p,g[1])}d&&l(u[p],"sham",!0)}},d959:function(t,e,a){},f665:function(t,e,a){"use strict";var i=a("23e7"),n=a("c65b"),r=a("2266"),o=a("59ed"),s=a("825a"),l=a("46c4"),c=a("2a62"),u=a("f99f"),d=u("find",TypeError);i({target:"Iterator",proto:!0,real:!0,forced:d},{find:function(t){s(this);try{o(t)}catch(i){c(this,"throw",i)}if(d)return n(d,this,t);var e=l(this),a=0;return r(e,(function(e,i){if(t(e,a++))return i(e)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})}}]);