text: (("undefined"!==typeof self?self:this)["webpackChunkadvanced_import"]=("undefined"!==typeof self?self:this)["webpackChunkadvanced_import"]||[]).push([[333],{2333:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return C}});var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("p",[e._v("The wizard guessed the mapping for you but you can adjust the mapping as needed and select the dynamic fields.")]),n("table",{staticClass:"table table-striped table-bordered"},[n("thead",[n("tr",[n("th",{staticClass:"text-nowrap"},[e._v("Dynamic "),n("b-button",{directives:[{name:"b-modal",rawName:"v-b-modal.modal-dynamic-fields",modifiers:{"modal-dynamic-fields":!0}}],attrs:{size:"sm",variant:"outline-info"}},[n("font-awesome-icon",{staticClass:"icon",attrs:{icon:["fas","question-circle"]}})],1)],1),n("th",[e._v("Destination Field (REDCap)")]),n("th",[e._v("Source Field (CSV file)")])])]),n("tbody",e._l(e.form_fields,(function(t,i){return n("tr",{key:i},[n("td",{staticClass:"min text-right"},[t.field_name!==e.primary_key?n("b-form-checkbox",{attrs:{disabled:!e.hasMapping(t.field_name),checked:e.isDynamic(t.field_name),switch:""},on:{input:function(n){return e.onDynamicToggle(t.field_name,n)}}}):e._e()],1),n("td",[n("span",{staticClass:"d-flex flex-row align-items-center"},[n("span",{staticClass:"font-weight-bold"},[e._v(e._s(t.field_name))]),t.field_name===e.primary_key?n("font-awesome-icon",{staticClass:"icon text-warning ml-1",attrs:{title:"primary key",icon:["fas","star"]}}):e._e()],1),n("span",{staticClass:"small",domProps:{innerHTML:e._s(t.element_label)}})]),n("td",["checkbox"==t.element_type?[n("CsvFieldsDropDown",{attrs:{redcapFieldName:t.field_name,redcapFieldType:t.element_type}})]:[n("CsvFieldsSingleSelect",{attrs:{redcapFieldName:t.field_name}})]],2)])})),0)]),n("b-modal",{attrs:{id:"modal-dynamic-fields",title:"Dynamic fields","ok-only":""}},[n("div",{staticClass:"my-4"},[n("p",[e._v('Mark as "dynamic" the fields that are not relevant in determining the uniqueness of an entry (i.e. can be different compared to existing data).')]),n("p",[e._v('If you are importing "medications" in a repeated form, for example, you may want to mark the "status" field as dynamic since it could have changed since the previous import.')]),n("p",[e._v("Dynamic fields will be ignored when the wizard will try to determine the uniqueness of a row.")])])]),n("p",[e._v("Remember to map the primary key to proceed.")]),n("div",{staticClass:"buttons d-flex flex-row justify-content-between"},[e._t("left"),e._t("default"),e._t("right",null,{validation:e.$v})],2)],1)},s=[],r=n(722),a=n(4100),d=(n(2479),n(9720),n(6699),n(2023),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("b-container",e._l(e.checkboxOptions,(function(t,i){return n("b-row",{key:i,staticClass:"d-flex flex-column option"},[n("b-col",{staticClass:"small"},[n("span",[e._v("["+e._s(i)+"]:")]),n("span",{staticClass:"ml-1"},[e._v(e._s(t))])]),n("b-col",{},[n("CsvFieldsSingleSelect",{attrs:{redcapFieldName:e.redcapFieldName,fieldIndex:i}})],1)],1)})),1)}),o=[],l=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("b-dropdown",{staticClass:"w-100",attrs:{text:"Dropdown Button",variant:e.hasMapping?"success":"outline-primary",lazy:""},scopedSlots:e._u([{key:"button-content",fn:function(){return[n("span",[e._v(e._s(e.selectedText))])]},proxy:!0}])},[n("b-dropdown-item",{attrs:{active:e.skip},on:{click:function(t){return e.onChange(null)}}},[e._v("-- skip --")]),e._l(e.csv_fields,(function(t,i){return n("b-dropdown-item",{key:i,attrs:{disabled:!e.isMapped(i)&&e.isMappedElsewhere(i),active:e.isMapped(i)},on:{click:function(t){return e.onChange(i)}}},[n("span",[e._v(e._s(t))])])}))],2)],1)},c=[],u=(n(3161),n(9653),n(7327),n(1539),n(629)),p={data:function(){return{}},computed:(0,a.Z)((0,a.Z)({},(0,u.rn)({csv_fields:function(e){return e.csv_data.fields},mapping:function(e){return e.import_settings.mapping}})),{},{options:function(){var e=this.csv_fields,t=[],n={value:null,text:"-- skip --"};for(var i in t.push(n),e){var s={value:i,text:e[i]};t.push(s)}return t},csvIndexes:function(){return this.$store.getters["import_settings/mappedCsvFields"](this.redcapFieldName)},selectedText:function(){var e="--- skip ---",t=this.csvIndexes;if(t.length<1)return e;var n=t[this.fieldIndex];return Number.isInteger(n)?this.csv_fields[n]:e},skip:function(){return!Array.isArray(this.csvIndexes)||!Number.isInteger(this.csvIndexes[this.fieldIndex])},hasMapping:function(){return Number.isInteger(this.csvIndexes[this.fieldIndex])}}),props:{redcapFieldName:{type:String,default:""},redcapFieldType:{type:String,default:""},fieldIndex:{type:[Number,String],default:0}},methods:{isMappedElsewhere:function(e){for(var t=(0,a.Z)({},this.mapping),n=0,i=Object.entries(t);n<i.length;n++){var s=(0,r.Z)(i[n],2),d=s[0],o=s[1],l=void 0===o?{}:o;if(d==this.redcapFieldName){var c=Object.values(l).filter((function(t,n){return n!=e}));if(c.indexOf(e)>=0)return!0}else if(Object.values(l).indexOf(e)>=0)return!0}return!1},isMapped:function(e){return this.csvIndexes[this.fieldIndex]==e},onChange:function(e){var t=this.redcapFieldName,n=e,i=this.fieldIndex;this.$store.dispatch("import_settings/setFieldMapping",{fieldName:t,csvIndex:n,fieldIndex:i})}}},f=p,m=n(3736),h=(0,m.Z)(f,l,c,!1,null,"275dd28e",null),v=h.exports,_={components:{CsvFieldsSingleSelect:v},computed:{checkboxOptions:function(){var e=this.$store.getters["settings/checkboxFieldOptions"](this.redcapFieldName);return e}},props:{redcapFieldName:{type:String,default:""},redcapFieldType:{type:String,default:""}},methods:{}},g=_,y=(0,m.Z)(g,d,o,!1,null,"0c8532ff",null),b=y.exports,x={components:{CsvFieldsDropDown:b,CsvFieldsSingleSelect:v},data:function(){return{}},computed:(0,a.Z)((0,a.Z)({},(0,u.rn)({csv_fields:function(e){return e.csv_data.fields},primary_key:function(e){return e.import_settings.primary_key},mapping:function(e){return e.import_settings.mapping},dynamic_fields:function(e){return e.import_settings.dynamic_fields}})),{},{form_fields:function(){var e=this.$store.state.import_settings.form_name,t=this.primary_key,n=this.$store.getters["settings/mappable_fields"](e,t);return n}}),methods:{onDynamicToggle:function(e,t){this.$store.dispatch("import_settings/toggleDynamicField",{field:e,checked:t})},hasMapping:function(e){var t=this.$store.getters["import_settings/mappedCsvFields"](e);return Object.values(t).length>0},isDynamic:function(e){return this.dynamic_fields.indexOf(e)>=0}},validations:function(){var e=function(e){for(var t=[],n=0,i=Object.entries(e);n<i.length;n++){var s=(0,r.Z)(i[n],2),a=s[0],d=s[1],o=void 0===d?{}:d;Object.values(o).length>0&&t.push(a)}return t};return{mapping:{required:function(t){var n=e(t);return n.length>0},primaryKeyIsMapped:function(t){var n=e(t),i=this.primary_key;return n.includes(i)}}}}},k=x,w=(0,m.Z)(k,i,s,!1,null,"524a07fe",null),C=w.exports},4964:function(e,t,n){var i=n(5112),s=i("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[s]=!1,"/./"[e](t)}catch(i){}}return!1}},3929:function(e,t,n){var i=n(7850);e.exports=function(e){if(i(e))throw TypeError("The method doesn't accept regular expressions");return e}},6699:function(e,t,n){"use strict";var i=n(2109),s=n(1318).includes,r=n(1223);i({target:"Array",proto:!0},{includes:function(e){return s(this,e,arguments.length>1?arguments[1]:void 0)}}),r("includes")},2023:function(e,t,n){"use strict";var i=n(2109),s=n(3929),r=n(4488),a=n(4964);i({target:"String",proto:!0,forced:!a("includes")},{includes:function(e){return!!~String(r(this)).indexOf(s(e),arguments.length>1?arguments[1]:void 0)}})}}]);
  //# sourceMappingURL=advanced_import.umd.min.333.js.map