webpackJsonp([4],{"+66z":function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},"+gg+":function(t,e,r){var n=r("TQ3y")["__core-js_shared__"];t.exports=n},"+te5":function(t,e,r){var n=r("7lMT");"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);r("rjj0")("dd707630",n,!1,{sourceMap:!1})},"+tje":function(t,e,r){"use strict";var n=r("Xxa5"),i=r.n(n),o=r("exGp"),s=r.n(o),a=r("BO1k"),u=r.n(a),l=r("Dd8w"),c=r.n(l),p=r("kvU2"),d=r.n(p),f=r("PJh5"),h=r.n(f),m=r("fiaM"),v=r("NYxO"),g=r("HPim"),b=r("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:c()({isEditing:function(){return!!this.trip},modalOkTitle:function(){return this.loading?"Saving...":"Save"}},Object(v.mapState)({activeSeason:"activeSeason"})),methods:{initialiseFields:function(){this.params=d()(this.initialParams),this.isEditing||(this.params.assign_now=1);var t=!0,e=!1,r=void 0;try{for(var n,i=u()(this.params.segments);!(t=(n=i.next()).done);t=!0){var o=n.value;o.departure_time_date=h()(o.departure_time).format("YYYY-MM-DD"),o.departure_time_time=h()(o.departure_time).format("HH:mm"),o.arrival_time_date=h()(o.arrival_time).format("YYYY-MM-DD"),o.arrival_time_time=h()(o.arrival_time).format("HH:mm")}}catch(t){e=!0,r=t}finally{try{!t&&i.return&&i.return()}finally{if(e)throw r}}},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")}:{},r=m.a.bakeTripSegment(e);this.params.segments.push(r)},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,r=t.index,n=t.field;this.params.segments[r][n]=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,r=null,n=null,i=null;if(this.params.segments.length>0){var o=!0,s=!1,a=void 0;try{for(var l,p=u()(this.params.segments);!(o=(l=p.next()).done);o=!0){var f=l.value;this.syncSegmentTimes(f)}}catch(t){s=!0,a=t}finally{try{!o&&p.return&&p.return()}finally{if(s)throw a}}var h=["MED","JED","RUH","YNB"],m=d()(this.params.segments);e=m[0],r=m.find(function(t){return h.indexOf(t.arrival_airport)>-1}),n=m.find(function(t){return h.indexOf(t.departure_airport)>-1}),i=m.reverse().find(function(e){return e.arrival_airport===t.params.arrive_deviation_transit_airport})}return c()({},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:r?r.flight_code:null,arrive_saudi_airport:r?r.arrival_airport:null,arrive_saudi_time:r?r.arrival_time:null,depart_saudi_flight_code:n?n.flight_code:null,depart_saudi_airport:n?n.departure_airport:null,depart_saudi_time:n?n.departure_time:null,arrive_deviation_transit_flight_code:i?i.flight_code:null,arrive_deviation_transit_airport:i?i.arrival_airport:null,arrive_deviation_transit_time:i?i.arrival_time:null})},handleSubmit:function(){var t=s()(i.a.mark(function t(){var e;return i.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,r){var n=r("vjaL"),i=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||n};i.prototype.hsl=function(t){var e,r,n=this.hash(t);return e=n%359,n=parseInt(n/360),r=this.S[n%this.S.length],n=parseInt(n/this.S.length),[e,r,this.L[n%this.L.length]]},i.prototype.rgb=function(t){var e=this.hsl(t);return function(t,e,r){t/=360;var n=r<.5?r*(1+e):r+e-r*e,i=2*r-n;return[t+1/3,t,t-1/3].map(function(t){return t<0&&t++,t>1&&t--,t=t<1/6?i+6*(n-i)*t:t<.5?n:t<2/3?i+6*(n-i)*(2/3-t):i,Math.round(255*t)})}.apply(this,e)},i.prototype.hex=function(t){var e,r=this.rgb(t);return e="#",r.forEach(function(t){t<16&&(e+=0),e+=t.toString(16)}),e},t.exports=i},"/4xH":function(t,e,r){var n=r("/TtT");"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);r("rjj0")("17609277",n,!1,{sourceMap:!1})},"/Ce5":function(t,e,r){var n;n=function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=89)}([function(t,e){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,e){var r={}.hasOwnProperty;t.exports=function(t,e){return r.call(t,e)}},function(t,e,r){var n=r(54),i=r(14);t.exports=function(t){return n(i(t))}},function(t,e,r){t.exports=!r(8)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,r){var n=r(5),i=r(11);t.exports=r(3)?function(t,e,r){return n.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},function(t,e,r){var n=r(7),i=r(29),o=r(23),s=Object.defineProperty;e.f=r(3)?Object.defineProperty:function(t,e,r){if(n(t),e=o(e,!0),n(r),i)try{return s(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},function(t,e,r){var n=r(21)("wks"),i=r(12),o=r(0).Symbol,s="function"==typeof o;(t.exports=function(t){return n[t]||(n[t]=s&&o[t]||(s?o:i)("Symbol."+t))}).store=n},function(t,e,r){var n=r(9);t.exports=function(t){if(!n(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,r){var n=r(34),i=r(15);t.exports=Object.keys||function(t){return n(t,i)}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var r=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+n).toString(36))}},function(t,e){var r=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=r)},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,r){var n=r(5).f,i=r(1),o=r(6)("toStringTag");t.exports=function(t,e,r){t&&!i(t=r?t:t.prototype,o)&&n(t,o,{configurable:!0,value:e})}},function(t,e,r){var n=r(21)("keys"),i=r(12);t.exports=function(t){return n[t]||(n[t]=i(t))}},function(t,e,r){var n=r(0),i=n["__core-js_shared__"]||(n["__core-js_shared__"]={});t.exports=function(t){return i[t]||(i[t]={})}},function(t,e){var r=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:r)(t)}},function(t,e,r){var n=r(9);t.exports=function(t,e){if(!n(t))return t;var r,i;if(e&&"function"==typeof(r=t.toString)&&!n(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!n(i=r.call(t)))return i;if(!e&&"function"==typeof(r=t.toString)&&!n(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,e,r){var n=r(0),i=r(13),o=r(17),s=r(25),a=r(5).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=o?{}:n.Symbol||{});"_"==t.charAt(0)||t in e||a(e,t,{value:s.f(t)})}},function(t,e,r){e.f=r(6)},function(t,e){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,e,r){var n=r(9),i=r(0).document,o=n(i)&&n(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,e,r){var n=r(0),i=r(13),o=r(51),s=r(4),a=function(t,e,r){var u,l,c,p=t&a.F,d=t&a.G,f=t&a.S,h=t&a.P,m=t&a.B,v=t&a.W,g=d?i:i[e]||(i[e]={}),b=g.prototype,y=d?n:f?n[e]:(n[e]||{}).prototype;for(u in d&&(r=e),r)(l=!p&&y&&void 0!==y[u])&&u in g||(c=l?y[u]:r[u],g[u]=d&&"function"!=typeof y[u]?r[u]:m&&l?o(c,n):v&&y[u]==c?function(t){var e=function(e,r,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,r)}return new t(e,r,n)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(c):h&&"function"==typeof c?o(Function.call,c):c,h&&((g.virtual||(g.virtual={}))[u]=c,t&a.R&&b&&!b[u]&&s(b,u,c)))};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,r){t.exports=!r(3)&&!r(8)(function(){return 7!=Object.defineProperty(r(27)("div"),"a",{get:function(){return 7}}).a})},function(t,e,r){"use strict";var n=r(17),i=r(28),o=r(35),s=r(4),a=r(1),u=r(16),l=r(56),c=r(19),p=r(63),d=r(6)("iterator"),f=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,e,r,m,v,g,b){l(r,e,m);var y,_,x,w=function(t){if(!f&&t in j)return j[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},k=e+" Iterator",z="values"==v,C=!1,j=t.prototype,S=j[d]||j["@@iterator"]||v&&j[v],E=S||w(v),M=v?z?w("entries"):E:void 0,L="Array"==e&&j.entries||S;if(L&&(x=p(L.call(new t)))!==Object.prototype&&(c(x,k,!0),n||a(x,d)||s(x,d,h)),z&&S&&"values"!==S.name&&(C=!0,E=function(){return S.call(this)}),n&&!b||!f&&!C&&j[d]||s(j,d,E),u[e]=E,u[k]=h,v)if(y={values:z?E:w("values"),keys:g?E:w("keys"),entries:M},b)for(_ in y)_ in j||o(j,_,y[_]);else i(i.P+i.F*(f||C),e,y);return y}},function(t,e,r){var n=r(7),i=r(60),o=r(15),s=r(20)("IE_PROTO"),a=function(){},u=function(){var t,e=r(27)("iframe"),n=o.length;for(e.style.display="none",r(53).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("