Sindbad~EG File Manager
<script type="text/javascript">
$(function () {
var limit =100;
$("#spnTopic").text($("#txtTopic").val().length + " characters.");
$('textarea[id$=txtTopic]').keyup(function () {
var len = $(this).val().length;
if (len > limit) {
//this.value = this.value.substring(0, limit);
}
if(limit < $(this).val().length)
{
$("#spnTopic").addClass("red");
$("#spnTopic").removeClass("blue");
$("#spnTopic").text($(this).val().length + " characters. (Exceeded the limit. Shorten your topic)");
}
else
{
$("#spnTopic").addClass("blue");
$("#spnTopic").removeClass("red");
$("#spnTopic").text($(this).val().length + " characters.");
}
});
});
</script>
<script type="text/javascript">
var hdnICId = "#hdnICId";
var hdnUserId = "#hdnUserId";
var hdnCOIId = "#hdnCOIId";
var lblMemNo = "#lblMemNo";
var lblName = "#lblName";
var lblEmail = "#lblEmail";
var lblMobile = "#lblMobile";
var txtTopic = "#txtTopic";
var txtDuration = "#txtDuration";
var txtOrder = "#txtOrder";
function ShowModal()
{
$("#COIModal").modal({
show: true,
backdrop: 'static'
});
}
$(document).ready(function () {
COI_validation();
});
function COI_validation()
{
$("#form_coi").validate({
rules: {
txtTopic: {
required: true,
maxlength:100
},
txtDuration: {
required: true,
number:true,
min:1
},
txtOrder: {
required: true,
number:true,
min:1
}
}
//,
// messages : {
// min :'Invalid Deduction'
// }
});
}
function onSelectInAddEdit(userid,isci,coi_id)
{ //clear msg
errormsg("");
ShowModal();
clearCoidata();
$.ajax({
url: baseUrl + '/ic/getmemberdetailsbyid',
type: 'POST',
dataType: 'json',
async: false,
data: {'searchuserid': userid, 'isci' : isci,'coi_id' : coi_id},
})
.done(function(d) {
result = d;
setMemberData(result.data);
})
.fail(function() {
//alert("Internal Server Error");
return false;
});
return true;
}
function clearCoidata() {
$(txtTopic).val("");
$(txtOrder).val("");
$(txtDuration).val("");
}
function setMemberData(data) {
$(hdnICId).val($(hdnId).val());
$(hdnUserId).val(data.user_id);
$(hdnCOIId).val(data.author_id);
$(lblMemNo).text(data.membership_no?data.membership_no:'');
$(lblName).text(data.prefix +"."+data.name);
$(lblEmail).text(data.email==null?'':data.email);
$(lblMobile).text(data.mobile==null?'':data.mobile);
if(data.author_id >0)
{
$(txtTopic).val(data.topic);
$(txtOrder).val(data.order_no);
$(txtDuration).val(data.duration);
}
}
function OnSave() {
$("#btnSave").prop('disabled', true);
//clear msg
errormsg("");
COI_validation();
if(!$("#form_coi").valid())
{
$("#btnSave").prop('disabled', false);
return false;
}
$.ajax({
type: 'POST', // <-- get method of form
url: $("#form_coi").attr('action'), // <-- get action of form
data: $("#form_coi").serialize(),
async: false,
dataType: 'json',
// <-- serialize all fields into a string that is ready to be posted to your PHP file
beforeSend: function(){
//$('#result').html('<img src="loading.gif" />');
},
success: function(data){
if(data.code == 1)
{
closeModel("#COIModal");
$('#frm').html(data.data);
$("#btnSave").prop('disabled', false);
}
else
{
errormsg(data.msg)
$("#btnSave").prop('disabled', false);
}
}
});
}
</script>
<div id="COIModal" class="modal fade" role="dialog">
<div class="modal-dialog">
{{ Form::open(array('url' => 'ic/store_coi','role'=>'form','id'=>'form_coi')) }}
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn btn-small pull-right" data-dismiss="modal">Close</button>
<h4 class="modal-title">Add Co Instructor</h4>
</div>
<div class="modal-body">
<div class="alert alert-success" style="display:none">
</div>
<div class="alert alert-danger" style="display:none">
</div>
@if(Session::has('msg'))
<div class="alert alert-success">{{ Session::get('msg')}}</div>
@endif
@if(Session::has('msg_err'))
<div class="alert alert-danger">
{{ Session::get('msg_err')}}
</div>
@endif
{{ Form::hidden('hdnICId','0',array('id' => 'hdnICId')) }}
{{ Form::hidden('hdnUserId','0',array('id' => 'hdnUserId')) }}
{{ Form::hidden('hdnCOIId','0',array('id' => 'hdnCOIId')) }}
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<label>Membership No : </label>
<label id="lblMemNo"></label>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<label>Name: </label>
<label id="lblName"></label>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<label>Email: </label>
<label id="lblEmail"></label>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<label>Mobile: </label>
<label id="lblMobile"></label>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<label>Topic (not exceeding 100 characters)
</label>
<span id="spnTopic" class="blue">100 characters. </span>
{{ Form::textarea('txtTopic','',array('class' => '', 'id' => 'txtTopic' , 'placeholder' => 'Topic','rows' => 2)) }}
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12">
<label>Duration (minutes)</label>
{{ Form::text('txtDuration','',array('maxLength'=>'3','class' => 'form-control', 'id' => 'txtDuration' , 'placeholder' => '')) }}
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<label>Topic Order No</label>
{{ Form::text('txtOrder','',array('maxLength'=>'3','class' => 'form-control', 'id' => 'txtOrder' , 'placeholder' => '')) }}
</div>
</div>
</div>
<div class="modal-footer">
<button href="#" class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<input type="button" value="Save" id ="btnSave" class="btn btn-primary" onclick="OnSave()">
</div>
</div>
{{ Form::close() }}
</div>
</div>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists