<commit_before><template>
  <tr v-show="processDetail">
    <td colspan="5">
    <div class="col-md-12">

            <div class="row">
                <div class="dynamic-form-row">
                    <div class="col-md-5 col-xs-12">
                        <label for="import-type">Import Type:</label>
                    </div>

                    <div class="col-md-7 col-xs-12">
                        <select2 :options="options.importTypes" v-model="options.importType" required>
                            <option disabled value="0"></option>
                        </select2>
                    </div>

                </div><!-- /dynamic-form-row -->
                <div class="dynamic-form-row">
                    <div class="col-md-5 col-xs-12">
                        <label for="import-update">Update Existing Values?:</label>
                    </div>
                    <div class="col-md-7 col-xs-12">
                        <input type="checkbox" class="icheckbox_minimal" name="import-update" v-model="options.update">
                    </div>
                </div><!-- /dynamic-form-row -->

                <div class="dynamic-form-row">
                    <div class="col-md-5 col-xs-12">
                        <label for="send-welcome">Send Welcome Email for new Users?</label>
                    </div>
                    <div class="col-md-7 col-xs-12">
                        <input type="checkbox" class="icheckbox_minimal" name="send-welcome" v-model="options.send_welcome">
                    </div>
                </div><!-- /dynamic-form-row -->

                <div class="dynamic-form-row">
                    <div class="col-md-5 col-xs-12">
                        <label for="run-backup">Backup before importing?</label>
                    </div>
                    <div class="col-md-7 col-xs-12">
                        <input type="checkbox" class="icheckbox_minimal" name="run-backup" v-model="options.run_backup">
                    </div>
                </div><!-- /dynamic-form-row -->

                <div class="alert col-md-8 col-md-offset-2" style="text-align:left"
                     :class="alertClass"
                     v-if="statusText">
                    {{ this.statusText }}
                </div><!-- /alert -->
        </div> <!-- /div row -->

        <div class="row">
            <div class="col-md-12" style="padding-top: 30px;">
                <div class="col-md-4 text-right"><h4>Header Field</h4></div>
                <div class="col-md-4"><h4>Import Field</h4></div>
                <div class="col-md-4"><h4>Sample Value</h4></div>
            </div>
        </div><!-- /div row -->

        <template v-for="(header, index) in file.header_row">
            <div class="row">
                <div class="col-md-12">
                    <div class="col-md-4 text-right">
                        <label :for="header" class="control-label">{{ header }}</label>
                    </div>
                    <div class="col-md-4 form-group">
                        <div required>
                            <select2 :options="columns" v-model="columnMappings[header]">
                                <option value="0">Do Not Import</option>
                            </select2>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <p class="form-control-static">{{ activeFile.first_row[index] }}</p>
                    </div>
                </div><!-- /div col-md-8 -->
            </div><!-- /div row -->
        </template>

        <div class="row">
            <div class="col-md-6 col-md-offset-2 text-right" style="padding-top: 20px;">
                <button type="button" class="btn btn-sm btn-default" @click="processDetail = false">Cancel</button>
                <button type="submit" class="btn btn-sm btn-primary" @click="postSave">Import</button>
                <br><br>
            </div>
        </div><!-- /div row -->
        <div class="row">
            <div class="alert col-md-8 col-md-offset-2" style="padding-top: 20px;"
                 :class="alertClass"
                 v-if="statusText">
                {{ this.statusText }}
            </div>
        </div><!-- /div row -->

    </div><!-- /div v-show -->

    </td>
  </tr>
</template>

<script>
    var baseUrl = $('meta[name="baseUrl"]').attr('content');
    export default {
        props: ['file', 'customFields'],
        data() {
            return {
                activeFile: this.file,
                processDetail: false,
                statusText: null,
                statusType: null,
                options: {
                    importType: this.file.import_type,
                    update: false,
                    send_welcome: false,
                    run_backup: false,
                    importTypes: [
                        { id: 'asset', text: 'Assets' },
                        { id: 'accessory', text: 'Accessories' },
                        { id: 'consumable', text: 'Consumables' },
                        { id: 'component', text: 'Components' },
                        { id: 'license', text: 'Licenses' },
                        { id: 'user', text: 'Users' }
                    ],
                    statusText: null,
                },
                columnOptions: {
                    general: [
                        {id: 'category', text: 'Category' },
                        {id: 'company', text: 'Company' },
                        {id: 'email', text: 'Email' },
                        {id: 'item_name', text: 'Item Name' },
                        {id: 'location', text: 'Location' },
                        {id: 'maintained', text: 'Maintained' },
                        {id: 'manufacturer', text: 'Manufacturer' },
                        {id: 'order_number', text: 'Order Number' },
                        {id: 'purchase_cost', text: 'Purchase Cost' },
                        {id: 'purchase_date', text: 'Purchase Date' },
                        {id: 'quantity', text: 'Quantity' },
                        {id: 'requestable', text: 'Requestable' },
                        {id: 'serial', text: 'Serial Number' },
                        {id: 'supplier', text: 'Supplier' },
                        {id: 'username', text: 'Username' },
                        {id: 'department', text: 'Department' },
                    ],
                    accessories:[
                        {id: 'model_number', text: 'Model Number'},
                        {id: 'notes', text: 'Notes' },
                    ],
                    assets: [
                        {id: 'asset_tag', text: 'Asset Tag' },
                        {id: 'asset_model', text: 'Model Name' },
                        {id: 'asset_notes', text: 'Asset Notes' },
                        {id: 'model_notes', text: 'Model Notes' },
                        {id: 'checkout_class', text: 'Checkout Type' },
                        {id: 'checkout_location', text: 'Checkout Location' },
                        {id: 'image', text: 'Image Filename' },
                        {id: 'model_number', text: 'Model Number' },
                        {id: 'asset_notes', text: 'Asset Notes' },
                        {id: 'model_notes', text: 'Model Notes' },
                        {id: 'full_name', text: '<NAME>' },
                        {id: 'status', text: 'Status' },
                        {id: 'warranty_months', text: 'Warranty Months' },
                        {id: 'last_audit_date', text: 'Last Audit Date' },
                        {id: 'next_audit_date', text: 'Audit Date' },
                    ],
                    consumables: [
                        {id: 'item_no', text: "Item Number"},
                        {id: 'model_number', text: "Model Number"},
                        {id: 'min_amt', text: "Minimum Quantity"},
                        {id: 'notes', text: 'Notes' },
                    ],
                    licenses: [
                        {id: 'asset_tag', text: 'Assigned To Asset'},
                        {id: 'expiration_date', text: 'Expiration Date' },
                        {id: 'full_name', text: '<NAME>' },
                        {id: 'notes', text: 'Notes' },
                        {id: 'license_email', text: 'Licensed To Email' },
                        {id: 'license_name', text: 'Licensed To Name' },
                        {id: 'notes', text: 'Notes' },
                        {id: 'purchase_order', text: 'Purchase Order' },
                        {id: 'reassignable', text: 'Reassignable' },
                        {id: 'seats', text: 'Seats' },
                    ],
                    users: [
                        {id: 'employee_num', text: 'Employee Number' },
                        {id: 'first_name', text: '<NAME>' },
                        {id: 'jobtitle', text: 'Job Title' },
                        {id: 'last_name', text: '<NAME>' },
                        {id: 'phone_number', text: 'Phone Number' },
                        {id: 'manager_first_name', text: '<NAME>' },
                        {id: 'notes', text: 'Notes' },
                        {id: 'manager_last_name', text: '<NAME>' },
                        {id: 'notes', text: 'Notes' },
                        {id: 'activated', text: 'Activated' },
                        {id: 'address', text: 'Address' },
                        {id: 'city', text: 'City' },
                        {id: 'state', text: 'State' },
                        {id: 'zip', text: 'ZIP' },
                        {id: 'country', text: 'Country' },
                        {id: 'zip', text: 'ZIP' },

                    ],
                    customFields: this.customFields,
                },<commit_msg>Delete duplicate fields from the importer dropdown menu<commit_after><template>
  <tr v-show="processDetail">
    <td colspan="5">
    <div class="col-md-12">

            <div class="row">
                <div class="dynamic-form-row">
                    <div class="col-md-5 col-xs-12">
                        <label for="import-type">Import Type:</label>
                    </div>

                    <div class="col-md-7 col-xs-12">
                        <select2 :options="options.importTypes" v-model="options.importType" required>
                            <option disabled value="0"></option>
                        </select2>
                    </div>

                </div><!-- /dynamic-form-row -->
                <div class="dynamic-form-row">
                    <div class="col-md-5 col-xs-12">
                        <label for="import-update">Update Existing Values?:</label>
                    </div>
                    <div class="col-md-7 col-xs-12">
                        <input type="checkbox" class="icheckbox_minimal" name="import-update" v-model="options.update">
                    </div>
                </div><!-- /dynamic-form-row -->

                <div class="dynamic-form-row">
                    <div class="col-md-5 col-xs-12">
                        <label for="send-welcome">Send Welcome Email for new Users?</label>
                    </div>
                    <div class="col-md-7 col-xs-12">
                        <input type="checkbox" class="icheckbox_minimal" name="send-welcome" v-model="options.send_welcome">
                    </div>
                </div><!-- /dynamic-form-row -->

                <div class="dynamic-form-row">
                    <div class="col-md-5 col-xs-12">
                        <label for="run-backup">Backup before importing?</label>
                    </div>
                    <div class="col-md-7 col-xs-12">
                        <input type="checkbox" class="icheckbox_minimal" name="run-backup" v-model="options.run_backup">
                    </div>
                </div><!-- /dynamic-form-row -->

                <div class="alert col-md-8 col-md-offset-2" style="text-align:left"
                     :class="alertClass"
                     v-if="statusText">
                    {{ this.statusText }}
                </div><!-- /alert -->
        </div> <!-- /div row -->

        <div class="row">
            <div class="col-md-12" style="padding-top: 30px;">
                <div class="col-md-4 text-right"><h4>Header Field</h4></div>
                <div class="col-md-4"><h4>Import Field</h4></div>
                <div class="col-md-4"><h4>Sample Value</h4></div>
            </div>
        </div><!-- /div row -->

        <template v-for="(header, index) in file.header_row">
            <div class="row">
                <div class="col-md-12">
                    <div class="col-md-4 text-right">
                        <label :for="header" class="control-label">{{ header }}</label>
                    </div>
                    <div class="col-md-4 form-group">
                        <div required>
                            <select2 :options="columns" v-model="columnMappings[header]">
                                <option value="0">Do Not Import</option>
                            </select2>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <p class="form-control-static">{{ activeFile.first_row[index] }}</p>
                    </div>
                </div><!-- /div col-md-8 -->
            </div><!-- /div row -->
        </template>

        <div class="row">
            <div class="col-md-6 col-md-offset-2 text-right" style="padding-top: 20px;">
                <button type="button" class="btn btn-sm btn-default" @click="processDetail = false">Cancel</button>
                <button type="submit" class="btn btn-sm btn-primary" @click="postSave">Import</button>
                <br><br>
            </div>
        </div><!-- /div row -->
        <div class="row">
            <div class="alert col-md-8 col-md-offset-2" style="padding-top: 20px;"
                 :class="alertClass"
                 v-if="statusText">
                {{ this.statusText }}
            </div>
        </div><!-- /div row -->

    </div><!-- /div v-show -->

    </td>
  </tr>
</template>

<script>
    var baseUrl = $('meta[name="baseUrl"]').attr('content');
    export default {
        props: ['file', 'customFields'],
        data() {
            return {
                activeFile: this.file,
                processDetail: false,
                statusText: null,
                statusType: null,
                options: {
                    importType: this.file.import_type,
                    update: false,
                    send_welcome: false,
                    run_backup: false,
                    importTypes: [
                        { id: 'asset', text: 'Assets' },
                        { id: 'accessory', text: 'Accessories' },
                        { id: 'consumable', text: 'Consumables' },
                        { id: 'component', text: 'Components' },
                        { id: 'license', text: 'Licenses' },
                        { id: 'user', text: 'Users' }
                    ],
                    statusText: null,
                },
                columnOptions: {
                    general: [
                        {id: 'category', text: 'Category' },
                        {id: 'company', text: 'Company' },
                        {id: 'email', text: 'Email' },
                        {id: 'item_name', text: 'Item Name' },
                        {id: 'location', text: 'Location' },
                        {id: 'maintained', text: 'Maintained' },
                        {id: 'manufacturer', text: 'Manufacturer' },
                        {id: 'order_number', text: 'Order Number' },
                        {id: 'purchase_cost', text: 'Purchase Cost' },
                        {id: 'purchase_date', text: 'Purchase Date' },
                        {id: 'quantity', text: 'Quantity' },
                        {id: 'requestable', text: 'Requestable' },
                        {id: 'serial', text: 'Serial Number' },
                        {id: 'supplier', text: 'Supplier' },
                        {id: 'username', text: 'Username' },
                        {id: 'department', text: 'Department' },
                    ],
                    accessories:[
                        {id: 'model_number', text: 'Model Number'},
                        {id: 'notes', text: 'Notes' },
                    ],
                    assets: [
                        {id: 'asset_tag', text: 'Asset Tag' },
                        {id: 'asset_model', text: 'Model Name' },
                        {id: 'checkout_class', text: 'Checkout Type' },
                        {id: 'checkout_location', text: 'Checkout Location' },
                        {id: 'image', text: 'Image Filename' },
                        {id: 'model_number', text: 'Model Number' },
                        {id: 'asset_notes', text: 'Asset Notes' },
                        {id: 'model_notes', text: 'Model Notes' },
                        {id: 'full_name', text: 'Full Name' },
                        {id: 'status', text: 'Status' },
                        {id: 'warranty_months', text: 'Warranty Months' },
                        {id: 'last_audit_date', text: 'Last Audit Date' },
                        {id: 'next_audit_date', text: 'Audit Date' },
                    ],
                    consumables: [
                        {id: 'item_no', text: "Item Number"},
                        {id: 'model_number', text: "Model Number"},
                        {id: 'min_amt', text: "Minimum Quantity"},
                        {id: 'notes', text: 'Notes' },
                    ],
                    licenses: [
                        {id: 'asset_tag', text: 'Assigned To Asset'},
                        {id: 'expiration_date', text: 'Expiration Date' },
                        {id: 'full_name', text: '<NAME>' },
                        {id: 'notes', text: 'Notes' },
                        {id: 'license_email', text: 'Licensed To Email' },
                        {id: 'license_name', text: 'Licensed To Name' },
                        {id: 'notes', text: 'Notes' },
                        {id: 'purchase_order', text: 'Purchase Order' },
                        {id: 'reassignable', text: 'Reassignable' },
                        {id: 'seats', text: 'Seats' },
                    ],
                    users: [
                        {id: 'employee_num', text: 'Employee Number' },
                        {id: 'first_name', text: '<NAME>' },
                        {id: 'jobtitle', text: 'Job Title' },
                        {id: 'last_name', text: '<NAME>' },
                        {id: 'phone_number', text: 'Phone Number' },
                        {id: 'manager_first_name', text: '<NAME>' },
                        {id: 'notes', text: 'Notes' },
                        {id: 'manager_last_name', text: '<NAME>' },
                        {id: 'notes', text: 'Notes' },
                        {id: 'activated', text: 'Activated' },
                        {id: 'address', text: 'Address' },
                        {id: 'city', text: 'City' },
                        {id: 'state', text: 'State' },
                        {id: 'country', text: 'Country' },
                        {id: 'zip', text: 'ZIP' },

                    ],
                    customFields: this.customFields,
                },
{'fraction_non_alphanumeric': 0.15483870967741936, 'fraction_numerical': 0.006349206349206349, 'mean_word_length': 1.131274552597119, 'pattern_counts': {'":': 0, '<': 246, '<?xml version=': 0, '>': 246, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2493287', 'n_tokens_mistral': 5393, 'n_tokens_neox': 4968, 'n_words': 1144}