174 lines
8.6 KiB
PHP
174 lines
8.6 KiB
PHP
@extends('layouts.admin')
|
|
@section('content')
|
|
@php
|
|
$source_types = config('constant.sourceType');
|
|
$credit_report_providers = $providers;
|
|
@endphp
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12 col-xs-12">
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<h1>Credit Report Provider </h1>
|
|
</div>
|
|
<div class="panel-body">
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="panel-heading text-center">
|
|
<h4>Create Item</h4>
|
|
</div>
|
|
<form action="{{route('create.provider.link')}}" method="post" id="report_provider_add_form" class="needs-validation" >
|
|
@csrf
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label>Source Type</label>
|
|
<select class="form-control" name="source_type">
|
|
<option value=""> Select Report Provider</option>
|
|
@foreach($source_types as $key=>$value)
|
|
<option value="{{$value}}"> {{$key}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label>Link</label>
|
|
<input name="link" type="text" placeholder="e.g. https://smartcredit.com/" class="form-control link" autocomplete="off" >
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group pull-right" style="margin-right: 5px">
|
|
@if(isShowContent('create.provider.link'))
|
|
<button id="submit-button" type="submit" class="btn btn-md btn-info" >
|
|
<i class="fa fa-save fa-lg"></i>
|
|
<span>Save</span>
|
|
</button>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="panel-heading text-center">
|
|
<h4>Edit Item</h4>
|
|
</div>
|
|
<form action="{{route('update.provider.link')}}" method="post" id="report_provider_edit_form" class="needs-validation" >
|
|
@csrf
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label>Source Type</label>
|
|
<select class="form-control" name="edit_source_type">
|
|
<option value=""> Select Report Provider</option>
|
|
@foreach($source_types as $key=>$value)
|
|
<option value="{{$value}}"> {{$key}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label>Link</label>
|
|
<input name="edit_link" placeholder="e.g. https://smartcredit.com/" type="text" class="form-control">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group pull-right" style="margin-right: 5px">
|
|
@if(isShowContent('update.provider.link'))
|
|
<button id="submit-button" type="submit" name="edit" class="btn btn-md btn-info" >
|
|
<i class="fa fa-save fa-lg"></i>
|
|
<span>Save Change</span>
|
|
</button>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="panel-heading text-center">
|
|
<h4>Delete Item</h4>
|
|
</div>
|
|
<form action="{{route('delete.provider.link')}}" method="post" id="report_provider_delete_form" class="needs-validation">
|
|
@csrf
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12">
|
|
<label>Source Type</label>
|
|
<select class="form-control" name="delete_source_type">
|
|
<option value=""> Select Report Provider</option>
|
|
@foreach($source_types as $key=>$value)
|
|
<option value="{{$value}}"> {{$key}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group pull-right" style="margin-right: 5px">
|
|
@if(isShowContent('delete.provider.link'))
|
|
<button id="submit-button" type="submit" value="delete" name="delete" class="btn btn-md btn-danger" >
|
|
<i class="fa fa-delete-left fa-lg"></i>
|
|
<span>Delete</span>
|
|
</button>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@endsection
|
|
@push('script')
|
|
<script>
|
|
$(document).ready(function() {
|
|
common_helper.formValidate('#report_provider_add_form',
|
|
{'source_type':'required','link': 'required'},
|
|
{
|
|
'source_type':{required: "Please select a credit report provider"},
|
|
'link': {required: "Please enter valid link"}
|
|
|
|
}
|
|
);
|
|
common_helper.formValidate('#report_provider_edit_form',
|
|
{'edit_source_type':'required','edit_link': 'required'},
|
|
{
|
|
'edit_source_type':{required: "Please select a credit report provider"},
|
|
'edit_link': {required: "Please enter valid link"}
|
|
|
|
}
|
|
);
|
|
common_helper.formValidate('#report_provider_delete_form',
|
|
{'delete_source_type':'required'},
|
|
{
|
|
'delete_source_type':{required: "Please select a credit report provider"},
|
|
})
|
|
|
|
})
|
|
|
|
$('[name="edit_source_type"]').on('change', function(){
|
|
|
|
let providers = [];
|
|
|
|
let source_type_id = $('[name="edit_source_type"]').val();
|
|
|
|
providers = @php echo json_encode($credit_report_providers);@endphp;
|
|
|
|
let link = '';
|
|
|
|
if(source_type_id > 0) {
|
|
|
|
const provider = providers[parseInt(source_type_id)];
|
|
|
|
link = provider !== undefined ? provider : '';
|
|
}
|
|
$('[name="edit_link"]').val(link);
|
|
});
|
|
|
|
</script>
|
|
@endpush
|
|
|