mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-26 07:53:58 +00:00
update upload-honey-trap
This commit is contained in:
@@ -34,12 +34,20 @@ class ImportHoneyTrapController
|
||||
$excelRows = $excelRows->toArray();
|
||||
|
||||
$returnArray = [];
|
||||
$segment_name = 'honey trap campaign';
|
||||
$segment = Segment::where('name', $segment_name)->first();
|
||||
// $segment_name = 'honey trap campaign';
|
||||
// $segment = Segment::where('name', $segment_name)->first();
|
||||
$input_segment_id = $request->input('segment_id');
|
||||
if (!$input_segment_id) {
|
||||
$row['status'] = 'Failed';
|
||||
$row['message'] = 'segment_id cannot be empty';
|
||||
$returnArray[] = $row;
|
||||
return response()->json($returnArray);
|
||||
}
|
||||
|
||||
$segment = Segment::where('id', $input_segment_id)->first();
|
||||
if (!$segment) {
|
||||
$row['status'] = 'Failed';
|
||||
$row['message'] = '"' . $segment_name . '"' . ' not found';
|
||||
$row['message'] = 'Segment not found';
|
||||
$returnArray[] = $row;
|
||||
return response()->json($returnArray);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<error-message-component class="m-b-20" :error="error"></error-message-component>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component selectable :validator="$v.segment_id">
|
||||
<label>Segment</label>
|
||||
<selectable-component :endpoint="route('api.segment.list')" section="segmentsListSection_" valueColumn="id" :labelColumn="['name']" v-model="segment_id"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<file-input-component :validator="$v.files" v-model="files">
|
||||
@@ -59,12 +67,17 @@
|
||||
return {
|
||||
files: [],
|
||||
parameters: {},
|
||||
segment_id: null,
|
||||
options: null,
|
||||
returnData: null
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
files: {
|
||||
required
|
||||
},
|
||||
segment_id: {
|
||||
required
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -75,7 +88,8 @@
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.parameters = {
|
||||
files: this.files
|
||||
files: this.files,
|
||||
segment_id: this.segment_id,
|
||||
};
|
||||
this.submit(this.route('api.honey_trap.upload'), 'post', this.section, true, false);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user