Sindbad~EG File Manager
<?php $__env->startSection('title','Subscribe'); ?>
<?php $__env->startSection('content'); ?>
<?php echo Form::open(array('id'=>'formIndex','url' => 'subscription')); ?>
<header class="header">
<div class="row">
<div class="container">
<div class="col-lg-12 col-md-12 col-sm-12">
<img src="<?php echo isset($s->logo_url) ? $s->logo_url : ''; ?>" class="logo img-responsive" >
</div>
</div>
</div>
</header>
<div class="row">
<div class="container">
<div class="col-lg-12 col-md-12 col-sm-12 content">
<div class="subscription">
<div class="heading">
<h3>Manage your Subscription</h3>
</div>
<div class="placeholder">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<div id = "divMessage"><?php echo isset($msg) ? $msg : ''; ?></div>
</div>
</div>
</div>
<?php if(strcasecmp(CustomClass::$subscribe, $action) == 0): ?>
<div id = "divInputEntry">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<label>Email</label><br/><?php echo isset($c->email) ? $c->email : 'Invalid Email ID'; ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<?php echo Form::label('txtName','Name'); ?>
<?php echo Form::label('txtName','*',array('class'=>'reqspan')); ?>
<?php echo Form::text('txtName',isset($c->name) ? $c->name : null, array('id' => 'txtName' ,'class' => 'form-control req', 'maxlength' => '250', 'placeholder'=> 'Name')); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<label>Mobile ISD Code</label><br/>
<?php echo Form::text('txtMobileISD',isset($c->mobile_isd_code)?$c->mobile_isd_code:null, array('id' => 'txtMobileISD' ,'class' => 'form-control', 'maxlength' => '10', 'placeholder'=> 'ISD Code')); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<label>Mobile</label><br/>
<?php echo Form::text('txtMobile',isset($c->mobile)?$c->mobile:null, array('id' => 'txtMobile' ,'class' => 'form-control mob', 'maxlength' => '25', 'placeholder'=> 'Mobile')); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<label>Address</label><br/>
<?php echo Form::textarea('txtAddress',isset($c->address)?$c->address:null, array('id' => 'txtAddress' ,'class' => 'form-control', 'maxlength' => '1000', 'placeholder'=> 'Address','size' => '30x5')); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<label>Country</label><br/>
<?php echo Form::select('ddlCountry',$countries,$selected_country_id,array('id'=>'ddlCountry','class' => 'ddlCountry form-control input-md')); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<label>State</label><br/>
<?php echo Form::select('ddlState',$states,$selected_state_id,array('id'=>'ddlState','class' => 'ddlState form-control input-md')); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<label>City</label><br/>
<?php echo Form::select('ddlCity',$cities,$selected_city_id,array('id'=>'ddlCity','class' => 'ddlCity form-control input-md')); ?>
</div>
</div>
</div>
<?php if(isset($c->contact_id)): ?>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group text-center">
<a href="#" style="display:inline" class="cancel" id = "btnSubmit">Update personal information</a>
<?php echo Form::hidden('hdnContactID', Helper::encrypt($c->contact_id), array("id" => "hdnContactID")); ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php elseif(strcasecmp(CustomClass::$unsubscribe, $action) == 0): ?>
<?php if(isset($c)): ?>
<?php echo Form::open(array('id'=>'formIndex','url' => 'subscription')); ?>
<div id = "divUnSubContainer">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 text-center">
<div class="form-group">
<h4>Your email ID is <?php echo isset($c->email) ? $c->email : ""; ?></h4> <br>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 text-center">
<div class="form-group">
<button type="submit" id= "btnSubmit" class="unsub" title = "Click here to unsubscribe all emails from <?php echo isset($s->display_name) ? $s->display_name : ''; ?>"><h4>Click here to unsubscribe all emails from <?php echo isset($s->display_name) ? $s->display_name : ''; ?></h4></button>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 text-center">
<div class="form-group">
<a href="<?php echo URL::to('/'); ?>/subscription/view/<?php echo isset($s->society_id) ? $s->society_id : 0; ?>/<?php echo isset($action) && $action == CustomClass::$subscribe ? CustomClass::$subcancel : CustomClass::$unsubcancel; ?>" class="cancel">CANCEL</a>
</div>
</div>
</div>
</div>
<?php echo Form::hidden('hdnContactid', Helper::encrypt(isset($c->contact_id)?$c->contact_id : 0)); ?>
<?php echo Form::close(); ?>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php echo Form::close(); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script type="text/javascript">
var baseUrl = "<?php echo url('/'); ?>";
var bUrl = "<?php echo url('/'); ?>";
var divMessage = "#divMessage";
var divInputEntry = "#divInputEntry";
var divUnSubContainer = "#divUnSubContainer";
var ddlCountry = "#ddlCountry";
var ddlState = "#ddlState";
var ddlCity = "#ddlCity";
var btnSubmit = "#btnSubmit";
var btnCancelUnsub = "#btnCancelUnsub";
var hdnContactID = "#hdnContactID";
var stateSelectize = '';
var citySelectize = '';
function Contact()
{
var contact_id ;
var society_id ;
var society_name ;
var email ;
var mobile_isd_code ;
var mobile ;
var address ;
var city_id ;
var city ;
var state_id ;
var state ;
var subscribe_on ;
var unsubscribe_on ;
var created_at ;
var updated_at ;
var deleted_at ;
var name ;
var country_id ;
var country ;
}
function GetStatesByCountry(countryID)
{
var result = new Array();
$.ajax({
url: baseUrl + '/states/country',
type: 'POST',
dataType: 'json',
data: {countryID : countryID}
})
.done(function(data) {
result = data;
})
.fail(function() {
console.log('GetStatesByCountry');
});
return result;
}
function SetStates(states)
{
if($.isArray(states) && states.length > 0)
{
$.each(states, function (i, s) {
stateSelectize.addOption({value:s.state_id,text:s.state_name});
});
}
}
function GetCitiesByState(stateID)
{
var result = new Array();
$.ajax({
url: baseUrl + '/cities/state',
type: 'POST',
dataType: 'json',
data: {stateID : stateID}
})
.done(function(data) {
result = data;
})
.fail(function() {
console.log('GetCitiesByState');
});
return result;
}
function SetCities(cities)
{
if($.isArray(cities) && cities.length > 0)
{
$.each(cities, function (i, c) {
citySelectize.addOption({value:c.city_id,text:c.city_name});
});
}
}
function GetContact()
{
var c = new Contact();
c.contact_id = NullIfEmpty($(hdnContactID).val()) ;
c.name = NullIfEmpty($(txtName).val()) ;
c.mobile_isd_code = NullIfEmpty($(txtMobileISD).val()) ;
c.mobile = NullIfEmpty($(txtMobile).val()) ;
c.address = NullIfEmpty($(txtAddress).val()) ;
c.city_id = NullIfEmpty($(ddlCity).val()) ;
c.state_id = NullIfEmpty($(ddlState).val()) ;
c.country_id = NullIfEmpty($(ddlCountry).val()) ;
return c;
}
function StoreContact(contact)
{
var result = new Object();
$.ajax({
url: baseUrl + '/contact/store',
type: 'POST',
dataType: 'json',
data: { contact: JSON.stringify(contact)}
})
.done(function(data) {
result = data;
})
.fail(function() {
console.log('StoreContact');
});
return result;
}
$(function(){
if($(ddlState).length)
stateSelectize = $(ddlState).selectize()[0].selectize;
if($(ddlCity).length)
citySelectize = $(ddlCity).selectize()[0].selectize;
if($(ddlCountry).length)
$(ddlCountry).selectize();
// $(ddlState).selectize();
//$(ddlCity).selectize();
$.ajaxSetup({async : false});
$(ddlCountry).bind("change", function(){
stateSelectize.clearOptions();
citySelectize.clearOptions();
var states = new Array();
var countryID = $(this).val();
if($.isNumeric(countryID) && countryID > 0)
states = GetStatesByCountry(countryID);
SetStates(states);
return false;
});
$(ddlState).bind("change", function(){
citySelectize.clearOptions();
var cities = new Array();
var stateID = $(this).val();
if($.isNumeric(stateID) && stateID > 0)
cities = GetCitiesByState(stateID);
SetCities(cities);
return false;
});
$(btnSubmit).bind("click",function(){
var clientValidation = Validate(divInputEntry, true);
var contact = new Contact();
if(clientValidation === true)
contact = GetContact();
var result = new Object();
if(!$.isEmptyObject(contact))
result = StoreContact(contact);
if(!$.isEmptyObject(result))
{
$(divMessage).html(result.msg);
if(result.status == true)
$(divInputEntry).css({display : "none"});
}
return false;
});
/* $(btnCancelUnsub).bind("click", function(){
$(divUnSubContainer).hide();
$(divMessage).html('Thank you! for choosing not to unsubscribe.');
return false;
});*/
})
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists