webpackJsonp([9],{"5N1Y":function(t,e,s){"use strict";var n=s("M4fF"),a=s.n(n),i=(s("NYxO"),s("WES1"));e.a={props:{row:{type:Object,required:!0}},data:function(){return{packageId:null}},components:{DiffList:i.a},watch:{packageId:function(t){this.$store.commit("import/setChangeAttribute",{row:this.row,attribute:"package_id",value:t})}},computed:{selectedCandidateIndex:{get:function(){return this.row.selected_candidate_index},set:function(t){this.$store.commit("import/setSelectedCandidateIndex",{row:this.row,index:t})}},status:function(){return this.isNew?"New":this.isExists?"Found":this.isVague?"Multiple":""},isNew:function(){return!this.row.candidate_ids||0===this.row.candidate_ids.length},isVague:function(){return this.row.candidate_ids&&this.row.candidate_ids.length>1},isExists:function(){return this.row.candidate_ids&&1===this.row.candidate_ids.length},statusVariant:function(){return this.isNew?"warning":this.isExists?"secondary":this.isVague?"danger":""},candidates:function(){var t=this;return this.isNew?[]:a.a.map(this.row.candidate_ids,function(e){return t.$store.getters["registrations/getRegistration"](e)})},selectedCandidate:function(){return"null"!=typeof this.selectedCandidateIndex?this.candidates[this.selectedCandidateIndex]:null},selectedChangeSet:function(){return"null"!=typeof this.selectedCandidateIndex?this.row.change_sets[this.selectedCandidateIndex]:null}},methods:{discardChange:function(t){console.log("discardChange",{row:this.row,attribute:t}),this.$store.commit("import/removeChange",{row:this.row,attribute:t})},discardRow:function(){this.$store.commit("import/removeRow",{index:this.row.index})}}}},"7le8":function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=s("K9MR"),a=s("8gOI"),i=!1;var r=function(t){i||s("jy89")},o=s("VU/8")(n.a,a.a,!1,r,"data-v-0ceca259",null);o.options.__file="pages/admin/import/review.vue",e.default=o.exports},"8gOI":function(t,e,s){"use strict";var n=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[t.activeChangelist.length?s("div",[t.results?s("b-card",{attrs:{"no-body":""}},[s("b-card-header",[s("div",{staticClass:"mb-2 d-flex justify-content-between"},[s("h5",{staticClass:"mb-0 mt-2 p-2"},[t._v("Import Complete")]),s("b-btn",{staticClass:"m-0",attrs:{variant:"primary"},on:{click:t.done}},[t._v("Done")])],1)]),s("b-card-body",[s("p",[s("strong",[t._v("Created:")]),t._v("\n "+t._s(t.results.total_created)+"\n ")]),s("p",[s("strong",[t._v("Updated:")]),t._v("\n "+t._s(t.results.total_updated)+"\n ")]),s("p",[s("strong",[t._v("Failed:")]),t._v("\n "+t._s(t.results.failed.length)+"\n ")]),t.results.failed.length?s("ul",t._l(t.results.failed,function(e){return s("li",{key:e.id},[t._v(t._s(e.reference_number)+" "+t._s(e.given_names)+" "+t._s(e.last_name))])})):t._e()])],1):s("b-card",{attrs:{"no-body":""}},[s("b-card-header",{staticClass:"sticky-top"},[s("div",{staticClass:"mb-2 d-flex justify-content-between"},[s("h5",{staticClass:"mb-0 mt-2 p-2"},[t._v("Importing "+t._s(t.activeChangelist.length)+" rows - Found "+t._s(t.existingCandidates.length)+", New "+t._s(t.newCandidates.length))]),s("b-btn-group",[s("b-btn",{staticClass:"m-0",attrs:{variant:"success"},on:{click:t.onSave}},[t._v("Save")]),s("b-btn",{staticClass:"m-0",attrs:{variant:"secondary"},on:{click:function(e){return e.preventDefault(),t.onCancel(e)}}},[t._v("Cancel")])],1)],1)]),s("div",[s("b-alert",{staticClass:"m-0",attrs:{show:"",variant:"warning"}},[s("div",[t._v("The list below shows all the changes you are about to make for this import. Please ensure that all fields are correct before saving.")]),t.namesChangelist.length||t.nameChangesOnly?s("div",[s("hr"),s("p",[t._v("Pay close attention to name changes, as the import may have split up the full name incorrectly.")]),s("div",[t.nameChangesOnly?s("div",[s("strong",[t._v("\n Showing "+t._s(t.namesChangelist.length)+" name changes only.\n "),s("b-btn",{attrs:{variant:"primary"},on:{click:t.seeAll}},[t._v("See all")])],1)]):s("b-btn",{attrs:{variant:"primary"},on:{click:t.seeNameChangesOnly}},[t._v("Show "+t._s(t.namesChangelist.length)+" name changes")])],1)]):t._e()])],1),s("b-list-group",{attrs:{flush:""}},t._l(t.changelist,function(t){return s("b-list-group-item",{key:t.index},[s("import-item",{attrs:{row:t}})],1)}))],1)],1):s("div",[s("b-alert",{staticClass:"h5",attrs:{show:"",variant:"success"}},[s("i",{staticClass:"icon-check"}),t._v(" No differences were found between the import and your records\n ")]),s("b-btn",{attrs:{variant:"primary"},on:{click:t.done}},[t._v("Done")])],1)])};n._withStripped=!0;var a={render:n,staticRenderFns:[]};e.a=a},DPxO:function(t,e,s){"use strict";var n=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("ul",t._l(t.list,function(e,n){return s("li",{key:n,staticClass:"mb-2"},[s("strong",[t._v(t._s(n)+":")]),s("div",{staticClass:"d-inline-block ml-2 text-muted"},[t._v(t._s(e.old_value||"none"))]),s("i",{staticClass:"ml-2 fa fa-long-arrow-right"}),s("div",{staticClass:"d-inline-block ml-2 text-success"},[t._v(t._s(e.new_value))]),s("a",{staticClass:"text-danger cursor-pointer ml-2",on:{click:function(e){t.discardChange(n)}}},[s("i",{staticClass:"icon-close"}),t._v(" Discard")])])}))};n._withStripped=!0;var a={render:n,staticRenderFns:[]};e.a=a},K9MR:function(t,e,s){"use strict";var n=s("Xxa5"),a=s.n(n),i=s("exGp"),r=s.n(i),o=s("Dd8w"),c=s.n(o),l=s("M4fF"),d=(s.n(l),s("NYxO")),u=s("tvzI");e.a={layout:"admin",components:{ImportItem:u.a},data:function(){return{nameChangesOnly:!1}},created:function(){this.changelist?this.$store.commit("import/clearResults"):this.$router.push({name:"admin-import"})},computed:c()({changelist:function(){return this.nameChangesOnly?this.namesChangelist:this.activeChangelist}},Object(d.mapState)("import",{activeChangelist:function(t){return t.activeImport.changelist},results:function(t){return t.results}}),Object(d.mapGetters)("import",["newCandidates","existingCandidates","vagueCandidates","namesChangelist"])),methods:{seeNameChangesOnly:function(){this.nameChangesOnly=!0},seeAll:function(){this.nameChangesOnly=!1},onSave:function(){this.vagueCandidates.length?confirm("Have you checked the rows with multiple matches? If not, you may overwrite the wrong person.")&&this.save():this.save()},save:function(){var t=r()(a.a.mark(function t(){return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.$store.commit("preFlight");case 2:return t.prev=2,t.next=5,this.$store.dispatch("import/commitChanges");case 5:return t.next=7,this.$store.commit("postFlight");case 7:t.next=14;break;case 9:return t.prev=9,t.t0=t.catch(2),this.showErrorNotification({message:"["+t.t0.response.status+"] "+t.t0.response.data.message}),t.next=14,this.$store.commit("postFlight");case 14:case"end":return t.stop()}},t,this,[[2,9]])}));return function(){return t.apply(this,arguments)}}(),onCancel:function(){confirm("You will lose any unsaved changes. Continue?")&&this.done()},done:function(){this.$router.push({name:"admin-import"})}},notifications:{showErrorNotification:{title:"Error",message:"Whoops, something went wrong",type:"error"}}}},SwlX:function(t,e,s){var n=s("z0IA");"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);s("rjj0")("8c486fe8",n,!1,{sourceMap:!1})},V22H:function(t,e,s){var n=s("sFDW");"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);s("rjj0")("e89d0262",n,!1,{sourceMap:!1})},WES1:function(t,e,s){"use strict";var n=s("nJDI"),a=s("DPxO"),i=!1;var r=function(t){i||s("V22H")},o=s("VU/8")(n.a,a.a,!1,r,"data-v-6890d2bc",null);o.options.__file="components/import/DiffList.vue",e.a=o.exports},jhdB:function(t,e,s){(t.exports=s("FZ+f")(!1)).push([t.i,".list-group-item[data-v-0ceca259]:hover{background-color:#fafafa}",""])},jy89:function(t,e,s){var n=s("jhdB");"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);s("rjj0")("b83b4fe2",n,!1,{sourceMap:!1})},nJDI:function(t,e,s){"use strict";e.a={props:{list:{required:!0}},created:function(){console.log(this.list)},methods:{discardChange:function(t){this.$emit("discard",t)}}}},ot41:function(t,e,s){"use strict";var n=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("b-row",[s("b-col",{attrs:{cols:"auto",sm:"2",md:"1"}},[s("b-badge",{attrs:{variant:t.statusVariant}},[t._v(t._s(t.status))])],1),s("b-col",[t.isNew?s("div",[s("p",[t._v("No match found. Creating new registration.")]),s("b-form-select",{attrs:{options:t.$store.state.registrations.packages,"text-field":"name","value-field":"id"},model:{value:t.packageId,callback:function(e){t.packageId=e},expression:"packageId"}},[s("option",{attrs:{slot:"first",disabled:""},domProps:{value:null},slot:"first"},[t._v("Choose a package...")])])],1):t._e(),t.isNew?t._e():s("div",[t.isExists?s("div",[t._v("\n "+t._s(t.selectedCandidate.reference_number)+" "+t._s(t.selectedCandidate.full_name)+"\n ")]):s("div",[s("b-form-group",{attrs:{label:"Found multiple possible matches. Choose one to update:"}},[s("b-form-radio-group",{attrs:{name:"radio-group-"+t.row.index},model:{value:t.selectedCandidateIndex,callback:function(e){t.selectedCandidateIndex=e},expression:"selectedCandidateIndex"}},t._l(t.candidates,function(e,n){return s("b-form-radio",{key:n,staticClass:"d-block",attrs:{value:n}},[t._v("\n "+t._s(e.reference_number)+" "+t._s(e.full_name)+"\n ")])}))],1)],1)]),t.selectedChangeSet?s("div",[s("diff-list",{attrs:{list:t.selectedChangeSet},on:{discard:t.discardChange}})],1):t._e()]),s("b-col",{staticClass:"text-right",attrs:{cols:"auto"}},[s("b-btn",{staticClass:"ml-2",attrs:{variant:"danger",size:"sm"},on:{click:function(e){t.discardRow()}}},[s("i",{staticClass:"icon-close"}),t._v(" Discard Row")])],1)],1)],1)};n._withStripped=!0;var a={render:n,staticRenderFns:[]};e.a=a},sFDW:function(t,e,s){(t.exports=s("FZ+f")(!1)).push([t.i,"",""])},tvzI:function(t,e,s){"use strict";var n=s("5N1Y"),a=s("ot41"),i=!1;var r=function(t){i||s("SwlX")},o=s("VU/8")(n.a,a.a,!1,r,"data-v-5caa3077",null);o.options.__file="components/import/ImportItem.vue",e.a=o.exports},z0IA:function(t,e,s){(t.exports=s("FZ+f")(!1)).push([t.i,"",""])}});