fixed shortcode edit issues plus refactoring
This commit is contained in:
118
resources/views/shortcodes/partials/edit-short-code.blade.php
Normal file
118
resources/views/shortcodes/partials/edit-short-code.blade.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<div class="modal fade" id="shortCodeEditMain" tabindex="-1" role="dialog" aria-labelledby="shortCodeEditModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<!-- <h4 class="modal-title">Default Modal</h4> -->
|
||||
<h5 class="modal-title text-center" id="shortCodeEditModalLabelHeading">Edit Short Code Form</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="notifyAreaEdit" class="alert alert-danger hidden"></div>
|
||||
<form class="form-vertical" method="POST" id="shortCodeEditForm" action="{{ url('clients/shortcodes_update') }}">
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="shortcode_id" id="shortCodeIDEdit">
|
||||
<input type="hidden" name="code_type" id="shortCodeTypeEdit">
|
||||
<input type="hidden" name="client_id" id="shortCodeClientIdEdit">
|
||||
<div class="row">
|
||||
|
||||
<div class="form-group" >
|
||||
<div class="col-md-12" style="padding-bottom: 5px;">
|
||||
<label for="nameEdit">Friendly Name *</label>
|
||||
<input type="text" class="form-control" name="name" id="nameEdit" required >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-12" style="padding-bottom: 5px">
|
||||
<label for="networks">Network *</label>
|
||||
<!-- 'multiple'=> 'true', -->
|
||||
{!! Form::select('network', $networks_raw, null, ['class' => 'form-control' , 'id' => 'networks', 'required' => 'required', 'style' => 'width: 100%']) !!}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" >
|
||||
<div class="col-md-12" style="padding-bottom: 5px;">
|
||||
<label for="shortCodeEdit">Code *</label>
|
||||
<input type="number" class="form-control" name="shortcode" id="shortCodeEdit" required >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-12" style="padding-bottom: 5px">
|
||||
<label for="tollFreeEdit">Toll Free</label>
|
||||
<select name="toll_free" id="tollFreeEdit" class="form-control" required style="width: 100%;">
|
||||
<option value="YES">YES</option>
|
||||
<option value="NO">NO</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-12" style="padding-bottom: 5px">
|
||||
<label for="monthlyFeeEdit">Monthly Fee</label>
|
||||
<input type="number" class="form-control" name="monthly_fee" id="monthlyFeeEdit" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-6">
|
||||
<div class='input-group date' id='myDatepicker22Edit' style="padding-bottom: 5px;">
|
||||
<label for="launchDateEdit">Launch Date</label>
|
||||
<input type="text" class="form-control" name="launch_date" id="launchDateEdit" required >
|
||||
<div class="input-group-addon">
|
||||
<span class="fa fa-calendar"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class='input-group date' id='myDatepicker223Edit' style="padding-bottom: 5px;">
|
||||
<label for="expiryDateEdit">Expiry Date</label>
|
||||
<input type="text" class="form-control" name="expiry_date" id="expiryDateEdit" required >
|
||||
<div class="input-group-addon">
|
||||
<span class="fa fa-calendar"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-12" style="padding-bottom: 5px">
|
||||
<label for="codeStatusEdit">Status</label>
|
||||
<select id="codeStatusEdit" name="status" class="form-control" required style="width: 100%;">
|
||||
<option value="LIVE">Live</option>
|
||||
<option value="PENDING">Pending</option>
|
||||
<option value="TESTING">Testing</option>
|
||||
<option value="INACTIVE">Inactive </option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" >
|
||||
<div class="col-md-12" style="padding-bottom: 5px;">
|
||||
<label for="remarksEdit">Remarks</label>
|
||||
<input type="text" class="form-control" name="remarks" id="remarksEdit"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group" style="margin-bottom: 0.2rem; padding-bottom: 5px; padding-top: 5px;">
|
||||
<div class="col-md-12" style="padding-bottom: 10px;">
|
||||
<button type="submit" class="btn btn-success btn-block updateBtn"> <i class="fa fa-send"></i> Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom: 0.2rem; padding-bottom: 5px; padding-top: 5px;">
|
||||
<div class="col-md-12" style="padding-bottom: 10px;">
|
||||
<button type="button" class="btn btn-danger btn-block shortCodeDelBtn"> <i class="fa fa-trash"></i> Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="margin-bottom: 0.5rem; padding-bottom: 5px; padding-top: 5px;">
|
||||
<div class="col-md-12">
|
||||
<button type="button" class="btn btn-dark btn-block" data-dismiss="modal"><i class="fa fa-close"></i> Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
<!-- /.modal -->
|
||||
@@ -9,7 +9,7 @@
|
||||
@endsection
|
||||
@section('content')
|
||||
@include('shortcodes.partials.create')
|
||||
@include('client.partials.edit-shortcodes')
|
||||
@include('shortcodes.partials.edit-short-code')
|
||||
|
||||
<div class="">
|
||||
<div class="page-title">
|
||||
@@ -93,6 +93,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#shortCodeEditForm').submit(function(evt){
|
||||
evt.preventDefault();
|
||||
var formData = new FormData($(this)[0]);
|
||||
@@ -130,49 +131,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.linkButton', function(){
|
||||
var theVal = $(this).siblings('.hiddenInput').val();
|
||||
console.log('heere at the wall' + theVal );
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: base_url + '/clients/get_shortcode/' + theVal,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
async: false,
|
||||
success: function (data){
|
||||
if (data.code === 1) {
|
||||
console.log(data);
|
||||
$('#shortCodeIDEdit').val(theVal);
|
||||
$('#nameEdit').val(data.result.name);
|
||||
$('#shortCodeClientIdEdit').val(data.result.client_id);
|
||||
$('#shortCodeTypeEdit').val(data.result.code_type);
|
||||
$('#shortCodeEdit').val(data.result.shortcode);
|
||||
$('#tollFreeEdit').val(data.result.toll_free).change();
|
||||
$('#monthlyFeeEdit').val(data.result.monthly_fee);
|
||||
$('#launchDateEdit').val(data.result.launch_date);
|
||||
$('#expiryDateEdit').val(data.result.expiry_date);
|
||||
$('#codeStatusEdit').val(data.result.status).change();
|
||||
$('#network').val(data.result.network).change();
|
||||
$('#remarksEdit').val(data.result.remarks);
|
||||
$('#shortCodeEditModal').modal('show');
|
||||
}
|
||||
else if (data.code > 1) {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: data.msg,
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Your request could not be handled. Try again !',
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function getShortCodeDetails(id){
|
||||
alert('heere at the wall from that side ' + id);
|
||||
}
|
||||
@@ -220,6 +179,7 @@
|
||||
title: "Short Code",
|
||||
field: "shortcode",
|
||||
sorter: "string",
|
||||
formatter:link,
|
||||
},
|
||||
{ title:"Network",
|
||||
field:"network",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
@endsection
|
||||
@section('content')
|
||||
@include('shortcodes.partials.create')
|
||||
@include('shortcodes.partials.edit-short-code')
|
||||
<div class="">
|
||||
<div class="page-title">
|
||||
<div class="title_left">
|
||||
@@ -91,11 +92,25 @@
|
||||
return "<a href='"+ base_url + "/ussdshortcodes/"+rowID+"' class='btn btn-link'>"+url+"</a>";
|
||||
//return '<a href="'+ base_url + '"/clients/"'+rowID+'" class="btn btn-link">'+ url +'</a>';
|
||||
}
|
||||
function link(cell, formatterParams){
|
||||
function linkOld(cell, formatterParams){
|
||||
var url = cell.getValue();
|
||||
var rowID = cell.getData().id
|
||||
return "<a href='"+ base_url + "/ussdshortcodes/"+rowID+"/edit' class='btn btn-link'>"+url+"</a>";
|
||||
}
|
||||
|
||||
function link(cell, formatterParams){
|
||||
var url = cell.getValue();
|
||||
var rowID = cell.getData().id
|
||||
//use rowID to fetch details from DB and populate form on the modal
|
||||
// return "<a href='"+ base_url + "/smsshortcodes/"+rowID+"/edit' class='btn btn-link' >"+url+"</a>";
|
||||
|
||||
|
||||
|
||||
//return "<input type='button' class='btn btn-link linkButton' value='" + url + "' name='" + url + "'/>";
|
||||
return "<input type='hidden' class='hiddenInput' value='" + rowID + "' name='" + url + "'/><button type='button' class='btn btn-link linkButton' >"+url+"</button>";
|
||||
// return "<a href='' class='btn btn-link'>"+url+"</a>";
|
||||
}
|
||||
|
||||
function cellDesign (cell, formatterParams){
|
||||
var value = cell.getValue();
|
||||
return "<span style='color:#54B4D3; font-weight:bold;'>" + value + "</span>";
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
@endsection
|
||||
@section('content')
|
||||
@include('shortcodes.partials.create')
|
||||
@include('shortcodes.partials.edit-short-code')
|
||||
<div class="">
|
||||
<div class="page-title">
|
||||
<div class="title_left">
|
||||
@@ -89,11 +90,23 @@
|
||||
return "<a href='"+ base_url + "/voiceshortcodes/"+rowID+"' class='btn btn-link'>"+url+"</a>";
|
||||
//return '<a href="'+ base_url + '"/clients/"'+rowID+'" class="btn btn-link">'+ url +'</a>';
|
||||
}
|
||||
function link(cell, formatterParams){
|
||||
function linkold(cell, formatterParams){
|
||||
var url = cell.getValue();
|
||||
var rowID = cell.getData().id
|
||||
return "<a href='"+ base_url + "/voiceshortcodes/"+rowID+"/edit' class='btn btn-link'>"+url+"</a>";
|
||||
}
|
||||
function link(cell, formatterParams){
|
||||
var url = cell.getValue();
|
||||
var rowID = cell.getData().id
|
||||
//use rowID to fetch details from DB and populate form on the modal
|
||||
// return "<a href='"+ base_url + "/smsshortcodes/"+rowID+"/edit' class='btn btn-link' >"+url+"</a>";
|
||||
|
||||
|
||||
|
||||
//return "<input type='button' class='btn btn-link linkButton' value='" + url + "' name='" + url + "'/>";
|
||||
return "<input type='hidden' class='hiddenInput' value='" + rowID + "' name='" + url + "'/><button type='button' class='btn btn-link linkButton' >"+url+"</button>";
|
||||
// return "<a href='' class='btn btn-link'>"+url+"</a>";
|
||||
}
|
||||
function cellDesign (cell, formatterParams){
|
||||
var value = cell.getValue();
|
||||
return "<span style='color:#54B4D3; font-weight:bold;'>" + value + "</span>";
|
||||
|
||||
Reference in New Issue
Block a user