/*! For license information please see LICENSES */ webpackJsonp([0],{"+66z":function(t,e){var i=Object.prototype.toString;t.exports=function(t){return i.call(t)}},"+7Sm":function(t,e,i){(t.exports=i("FZ+f")(!1)).push([t.i,".list-filter[data-v-1d62e14a]{opacity:.3;color:#20a8d8}.list-filter.is-enabled[data-v-1d62e14a]{opacity:1}",""])},"+gg+":function(t,e,i){var r=i("TQ3y")["__core-js_shared__"];t.exports=r},"+te5":function(t,e,i){var r=i("7lMT");"string"==typeof r&&(r=[[t.i,r,""]]),r.locals&&(t.exports=r.locals);i("rjj0")("dd707630",r,!1,{sourceMap:!1})},"+tje":function(t,e,i){"use strict";var r=i("Xxa5"),n=i.n(r),s=i("exGp"),o=i.n(s),a=i("BO1k"),l=i.n(a),c=i("Dd8w"),u=i.n(c),d=i("kvU2"),p=i.n(d),f=i("PJh5"),h=i.n(f),m=i("fiaM"),v=i("NYxO"),g=i("HPim"),b=i("NnWl");e.a={props:{registration:{type:Object,required:!0},trip:{type:Object}},components:{AirportAutocomplete:g.a},data:function(){return{modalId:this.trip?"edit-trip-"+this.trip.id:"add-trip-"+this.registration.id,loading:!1,initialParams:{assign_now:0,capacity:this.trip?this.trip.capacity:0,description:this.trip?this.trip.description:null,booking_reference:this.trip?this.trip.booking_reference:null,is_group_booking:this.trip?this.trip.is_group_booking:0,segments:this.trip?this.trip.segments:[],arrive_deviation_transit_airport:this.trip?this.trip.arrive_deviation_transit_airport:null},params:{}}},created:function(){var t=this;this.initialiseFields(),this.isEditing||b.a.$on("button-edit-trip.new",function(){console.log("button-edit-trip.new"),t.$bvModal.show(t.modalId)})},computed:u()({isEditing:function(){return!!this.trip},modalOkTitle:function(){return this.loading?"Saving...":"Save"}},Object(v.mapState)({activeSeason:"activeSeason"})),methods:{initialiseFields:function(){this.params=p()(this.initialParams),this.isEditing||(this.params.assign_now=1);var t=!0,e=!1,i=void 0;try{for(var r,n=l()(this.params.segments);!(t=(r=n.next()).done);t=!0){var s=r.value;s.departure_time_date=h()(s.departure_time).format("YYYY-MM-DD"),s.departure_time_time=h()(s.departure_time).format("HH:mm"),s.arrival_time_date=h()(s.arrival_time).format("YYYY-MM-DD"),s.arrival_time_time=h()(s.arrival_time).format("HH:mm")}}catch(t){e=!0,i=t}finally{try{!t&&n.return&&n.return()}finally{if(e)throw i}}},addSegment:function(){var t=this.params.segments.length>0?this.params.segments[this.params.segments.length-1]:null;t&&this.syncSegmentTimes(t);var e=t?{departure_airport:t.arrival_airport,departure_time:t.arrival_time,departure_time_date:h()(t.arrival_time).format("YYYY-MM-DD"),departure_time_time:h()(t.arrival_time).format("HH:mm")}:{},i=m.a.bakeTripSegment(e);this.params.segments.push(i)},removeSegment:function(t){this.params.segments.splice(t,1)},handleOk:function(t){t.preventDefault(),this.isValid()?this.handleSubmit():this.showError({message:"Form validation failed. Please check all values."})},isValid:function(){return!0},onAirportSelected:function(t){var e=t.airport,i=t.index,r=t.field;this.params.segments[i][r]=e.iata_code},onDeviationAirportSelected:function(t){var e=t.airport;t.index,t.field;this.params.arrive_deviation_transit_airport=e.iata_code},syncSegmentTimes:function(t){t.departure_time=h()(t.departure_time_date+" "+t.departure_time_time,"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm:ss"),t.arrival_time=h()(t.arrival_time_date+" "+t.arrival_time_time,"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm:ss")},bakePayload:function(){var t=this,e=null,i=null,r=null,n=null;if(this.params.segments.length>0){var s=!0,o=!1,a=void 0;try{for(var c,d=l()(this.params.segments);!(s=(c=d.next()).done);s=!0){var f=c.value;this.syncSegmentTimes(f)}}catch(t){o=!0,a=t}finally{try{!s&&d.return&&d.return()}finally{if(o)throw a}}var h=["MED","JED","RUH","YNB"],m=p()(this.params.segments);e=m[0],i=m.find(function(t){return h.indexOf(t.arrival_airport)>-1}),r=m.find(function(t){return h.indexOf(t.departure_airport)>-1}),n=m.reverse().find(function(e){return e.arrival_airport===t.params.arrive_deviation_transit_airport})}return u()({},this.params,{season_id:this.activeSeason.id,depart_home_flight_code:e?e.flight_code:null,depart_home_airport:e?e.departure_airport:null,depart_home_time:e?e.departure_time:null,arrive_saudi_flight_code:i?i.flight_code:null,arrive_saudi_airport:i?i.arrival_airport:null,arrive_saudi_time:i?i.arrival_time:null,depart_saudi_flight_code:r?r.flight_code:null,depart_saudi_airport:r?r.departure_airport:null,depart_saudi_time:r?r.departure_time:null,arrive_deviation_transit_flight_code:n?n.flight_code:null,arrive_deviation_transit_airport:n?n.arrival_airport:null,arrive_deviation_transit_time:n?n.arrival_time:null})},handleSubmit:function(){var t=o()(n.a.mark(function t(){var e;return n.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.loading=!0,e=this.bakePayload(),t.prev=2,!this.isEditing){t.next=8;break}return t.next=6,this.$store.dispatch("registrations/trips/update",{payload:e,parent:this.registration,modelId:this.trip.id});case 6:t.next=10;break;case 8:return t.next=10,this.$store.dispatch("registrations/trips/create",{payload:e,parent:this.registration});case 10:this.$refs.modal.hide(),this.showSuccess(),t.next=18;break;case 14:t.prev=14,t.t0=t.catch(2),console.error(t.t0),this.showError({message:"["+t.t0.response.status+"] "+t.t0.response.data.message});case 18:this.loading=!1;case 19:case"end":return t.stop()}},t,this,[[2,14]])}));return function(){return t.apply(this,arguments)}}()},notifications:{showError:{title:"Saving trip failed",message:"Whoops, something went wrong",type:"error"},showSuccess:{message:"Saved successfully",type:"success"}}}},"+x9i":function(t,e,i){var r=i("vjaL"),n=function(t){var e=[(t=t||{}).lightness,t.saturation].map(function(t){return t=t||[.35,.5,.65],"[object Array]"===Object.prototype.toString.call(t)?t.concat():[t]});this.L=e[0],this.S=e[1],this.hash=t.hash||r};n.prototype.hsl=function(t){var e,i,r=this.hash(t);return e=r%359,r=parseInt(r/360),i=this.S[r%this.S.length],r=parseInt(r/this.S.length),[e,i,this.L[r%this.L.length]]},n.prototype.rgb=function(t){var e=this.hsl(t);return function(t,e,i){t/=360;var r=i<.5?i*(1+e):i+e-i*e,n=2*i-r;return[t+1/3,t,t-1/3].map(function(t){return t<0&&t++,t>1&&t--,t=t<1/6?n+6*(r-n)*t:t<.5?r:t<2/3?n+6*(r-n)*(2/3-t):n,Math.round(255*t)})}.apply(this,e)},n.prototype.hex=function(t){var e,i=this.rgb(t);return e="#",i.forEach(function(t){t<16&&(e+=0),e+=t.toString(16)}),e},t.exports=n},"/4xH":function(t,e,i){var r=i("/TtT");"string"==typeof r&&(r=[[t.i,r,""]]),r.locals&&(t.exports=r.locals);i("rjj0")("17609277",r,!1,{sourceMap:!1})},"/Ce5":function(t,e,i){var r;r=function(){return function(t){function e(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}var i={};return e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,r){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=89)}([function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){var r=i(54),n=i(14);t.exports=function(t){return r(n(t))}},function(t,e,i){t.exports=!i(8)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,i){var r=i(5),n=i(11);t.exports=i(3)?function(t,e,i){return r.f(t,e,n(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){var r=i(7),n=i(29),s=i(23),o=Object.defineProperty;e.f=i(3)?Object.defineProperty:function(t,e,i){if(r(t),e=s(e,!0),r(i),n)try{return o(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var r=i(21)("wks"),n=i(12),s=i(0).Symbol,o="function"==typeof s;(t.exports=function(t){return r[t]||(r[t]=o&&s[t]||(o?s:n)("Symbol."+t))}).store=r},function(t,e,i){var r=i(9);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){var r=i(34),n=i(15);t.exports=Object.keys||function(t){return r(t,n)}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var i=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+r).toString(36))}},function(t,e){var i=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=i)},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e){t.exports={}},function(t,e){t.exports=!0},function(t,e){e.f={}.propertyIsEnumerable},function(t,e,i){var r=i(5).f,n=i(1),s=i(6)("toStringTag");t.exports=function(t,e,i){t&&!n(t=i?t:t.prototype,s)&&r(t,s,{configurable:!0,value:e})}},function(t,e,i){var r=i(21)("keys"),n=i(12);t.exports=function(t){return r[t]||(r[t]=n(t))}},function(t,e,i){var r=i(0),n=r["__core-js_shared__"]||(r["__core-js_shared__"]={});t.exports=function(t){return n[t]||(n[t]={})}},function(t,e){var i=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:i)(t)}},function(t,e,i){var r=i(9);t.exports=function(t,e){if(!r(t))return t;var i,n;if(e&&"function"==typeof(i=t.toString)&&!r(n=i.call(t)))return n;if("function"==typeof(i=t.valueOf)&&!r(n=i.call(t)))return n;if(!e&&"function"==typeof(i=t.toString)&&!r(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){var r=i(0),n=i(13),s=i(17),o=i(25),a=i(5).f;t.exports=function(t){var e=n.Symbol||(n.Symbol=s?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:o.f(t)})}},function(t,e,i){e.f=i(6)},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e,i){var r=i(9),n=i(0).document,s=r(n)&&r(n.createElement);t.exports=function(t){return s?n.createElement(t):{}}},function(t,e,i){var r=i(0),n=i(13),s=i(51),o=i(4),a=function(t,e,i){var l,c,u,d=t&a.F,p=t&a.G,f=t&a.S,h=t&a.P,m=t&a.B,v=t&a.W,g=p?n:n[e]||(n[e]={}),b=g.prototype,y=p?r:f?r[e]:(r[e]||{}).prototype;for(l in p&&(i=e),i)(c=!d&&y&&void 0!==y[l])&&l in g||(u=c?y[l]:i[l],g[l]=p&&"function"!=typeof y[l]?i[l]:m&&c?s(u,r):v&&y[l]==u?function(t){var e=function(e,i,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(u):h&&"function"==typeof u?s(Function.call,u):u,h&&((g.virtual||(g.virtual={}))[l]=u,t&a.R&&b&&!b[l]&&o(b,l,u)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,e,i){t.exports=!i(3)&&!i(8)(function(){return 7!=Object.defineProperty(i(27)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){"use strict";var r=i(17),n=i(28),s=i(35),o=i(4),a=i(1),l=i(16),c=i(56),u=i(19),d=i(63),p=i(6)("iterator"),f=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,i,m,v,g,b){c(i,e,m);var y,_,x,w=function(t){if(!f&&t in z)return z[t];switch(t){case"keys":case"values":return function(){return new i(this,t)}}return function(){return new i(this,t)}},k=e+" Iterator",C="values"==v,S=!1,z=t.prototype,j=z[p]||z["@@iterator"]||v&&z[v],D=j||w(v),E=v?C?w("entries"):D:void 0,F="Array"==e&&z.entries||j;if(F&&(x=d(F.call(new t)))!==Object.prototype&&(u(x,k,!0),r||a(x,p)||o(x,p,h)),C&&j&&"values"!==j.name&&(S=!0,D=function(){return j.call(this)}),r&&!b||!f&&!S&&z[p]||o(z,p,D),l[e]=D,l[k]=h,v)if(y={values:C?D:w("values"),keys:g?D:w("keys"),entries:E},b)for(_ in y)_ in z||s(z,_,y[_]);else n(n.P+n.F*(f||S),e,y);return y}},function(t,e,i){var r=i(7),n=i(60),s=i(15),o=i(20)("IE_PROTO"),a=function(){},l=function(){var t,e=i(27)("iframe"),r=s.length;for(e.style.display="none",i(53).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("