mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
94 lines
4.0 KiB
Vue
94 lines
4.0 KiB
Vue
<template>
|
|
<div class="row">
|
|
<div class="col">
|
|
<div class="row" @keyup.enter="submitForm">
|
|
<div class="col ml-md-3 ml-0 mt-md-0 mt-3 bg-white padding-15">
|
|
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
|
|
<div class="row" v-show="!$store.getters.isLoading(section)" v-if="!returnData">
|
|
<div class="col">
|
|
<div class="row m-b-10">
|
|
<div class="col">
|
|
<div class="font-heading fs-16 all-caps bold m-b-15">Upload Honey Trap Csv</div>
|
|
</div>
|
|
</div>
|
|
<error-message-component class="m-b-20" :error="error"></error-message-component>
|
|
<div class="row">
|
|
<div class="col">
|
|
<file-input-component :validator="$v.files" v-model="files">
|
|
<template slot="label">
|
|
<div class="font-heading fs-11 text-primary all-caps">Honey Trap Csv</div>
|
|
</template>
|
|
</file-input-component>
|
|
</div>
|
|
</div>
|
|
<div class="row m-t-20">
|
|
<div class="col">
|
|
<div class="row">
|
|
<div class="col">
|
|
<button type="button" class="btn btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-success b-rad-none" @click="submitForm">Upload & Update</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div v-if="returnData">
|
|
<div class="font-heading fs-16 all-caps bold m-b-15">Uploaded Customer</div>
|
|
<table class="w-100 table table-bordered">
|
|
<tr class="thead-dark">
|
|
<th class="text-capitalize" v-for="key in returnDataKeys"> {{ key }}</th>
|
|
</tr>
|
|
<tr v-for="row in returnData">
|
|
<td v-for="col in row" :class="[{'text-danger': row['status'] == 'failed'}]">
|
|
{{ col }}
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import ModalFromHandler from '../../../general/mixins/modalFormHandler'
|
|
import { required } from "vuelidate/lib/validators";
|
|
export default {
|
|
data(){
|
|
return {
|
|
files: [],
|
|
parameters: {},
|
|
returnData: null
|
|
}
|
|
},
|
|
validations: {
|
|
files: {
|
|
required
|
|
}
|
|
},
|
|
computed: {
|
|
returnDataKeys() {
|
|
return Object.keys(Object.assign({}, this.returnData[0]))
|
|
},
|
|
},
|
|
methods: {
|
|
submitForm(){
|
|
this.parameters = {
|
|
files: this.files
|
|
};
|
|
this.submit(this.route('api.honey_trap.upload'), 'post', this.section, true, false);
|
|
},
|
|
errorHandler(error){
|
|
console.log(error);
|
|
},
|
|
successHandler(response) {
|
|
console.log(response);
|
|
this.returnData = response;
|
|
console.log(this.returnDataKeys);
|
|
},
|
|
},
|
|
mixins: [ModalFromHandler]
|
|
|
|
}
|
|
</script> |