File: /home/barbeatleanalyti/www/m.beatleanalytics.com/application/views/beatleAdmin/manageoffers.php
<?php
include('include/header.php');
$this->load->model('Admin_model');
$liveBannerPath = 'http://'.$_SERVER['HTTP_HOST'].'/owner.beatleanalytics.com/documents/local/offers/';
if($_SERVER['HTTP_HOST'] != '192.168.2.103' && $_SERVER['HTTP_HOST'] != '192.168.2.105' && $_SERVER['HTTP_HOST'] != 'localhost' && $_SERVER['HTTP_HOST'] != 'kalpeshpc'){
if( preg_match('/m.beatle/', $_SERVER['HTTP_HOST'])){
$liveBannerPath = 'http://manage.beatleanalytics.com/documents/manage/offers/';
}else if(preg_match('/admin.beatle/', $_SERVER['HTTP_HOST'])){
$liveBannerPath = 'http://manage.beatleanalytics.com/documents/owner/offers/';
}else if(preg_match('/newdemo.beatle/', $_SERVER['HTTP_HOST'])){
$liveBannerPath = 'http://owner.beatleanalytics.com/documents/owner/offers/';
}
}
define('BANNER_PATH',$liveBannerPath);
$msgArr = array("success","img_size_error","title_taken","img_ext_error","img_not_copied");
?>
<script>
$(document).ready(function(){
// ================== DELETE USER START FROM HERE ========================
$(".deluser").click(function(){
var txt;
var r = confirm("Would you like to delete this data");
if (r == true)
{
var deluser = $(this);
var id = deluser.attr('data-uid');
var token = 'deleteuser';
$.ajax({
type : 'POST',
url : 'deleteUserById',
data : {id:id,token:token},
success : function(res)
{
//alert(res);
$("#rowid_"+id).hide('500');
}
});
}
else
{
}
});
$("#searchUser").change(function()
{
var usertype = $("#searchUser").val();
$.ajax({
type : 'POST',
url : 'SearchUserByType',
data : {usertype:usertype},
success : function(res)
{
if (res)
{
$("#hidedata").hide();
$("#showdata").html(res);
}
}
});
});
$('#example').DataTable();
$("#orgname").keyup(function(){
var Orgname = $("#orgname").val();
$("#dataajaxorg").show(400);
$.ajax
({
type : 'POST',
url : '<?php echo base_url();?>index.php/beatleAdmin/getAjaxOrgByName',
data : {Orgname:Orgname},
//dataType:'json',
success : function(res)
{
$("#dataajaxorg").html(res);
$(".orgclass").click(function()
{
var Orgid = $(this).attr('data-orgid');
var Orgname = $(this).attr('data-orgname');
var perm = $(this).attr('data-perm');
$("#orgname").val(Orgname);
$("#mainOrgId").val(Orgid);
$("#orgid_edit").val(Orgid);
$("#dataajaxorg").hide(500);
});
},
beforeSend: function(){
// Code to display spinner
$("#ownerload").show();
},
complete: function(){
// Code to hide spinner.
$("#ownerload").hide();
}
})
});
$('#startdate').daterangepicker({
singleDatePicker: 0,
singleClasses: "picker_1"
}, function(start, end, label) {
console.log(start.toISOString(), end.toISOString(), label);
});
});
</script>
<style>
.ajaxcalldata
{
padding:5px;
color:#FFF;
cursor:pointer;
background-color:rgb(76,76,76);
}
.success_div
{
padding:100%; padding:10px; color:#FFF; background-color:#42af42;border-radius:4px; text-align:center;margin-top:20px;
}
.error_div
{
padding:100%; padding:10px; color:#FFF; background-color:#FF0000;border-radius:4px; text-align:center;margin-top:20px;
}
</style>
<?php
if($this->uri->segment(3) == '' || $this->uri->segment(3) == 'list') {
/*echo '<pre style="margin-left:200px;">';
print_r($productData);
echo '</pre>';*/
?>
<div class="right_col" role="main">
<div class="">
<div class="col-md-12 col-sm-12 col-xs-12">
<!-----------------------new theme--------------------------------->
<div class="new-theme">
<h1>Offers Details</h1>
<br>
<table id="datatable" class="table table-striped new-table">
<thead>
<tr>
<th style="max-width:200px !important;" >UniqueID</th>
<th>Title</th>
<th>Client</th>
<th>Dates</th>
<th>Description</th>
<th>Points between</th>
<th>Comments</th>
<th>status</th>
<th>on hold</th>
<th>Banner</th>
<th style="max-width:50px !important;">Action</th>
</tr>
</thead>
<tbody>
<?php
if (empty($productData)){ ?>
<tr class="ng-hide">
<td colspan="13"><h1 class="text-center text-muted ng-scope">No any data found.</h1><!-- end ngIf: !UsersList.ui.loading --></td>
</tr>
<?php } else {
foreach ($productData as $keyuser=>$valuser){
//echo "<pre>";
//print_r($productData);
//echo "</pre>";
//if ($valuser->db_usertype != 'SU_admin')
//{
?>
<tr id="rowid_<?php echo $valuser->offerid;?>">
<td style="max-width:200px !important;" ><?php echo $valuser->offeruid;?></td>
<td align="left"><?php echo $valuser->title;?></td>
<?php
$rsOrgData = $this->Admin_model->getAllUsersownerByOrgId($valuser->orgid);
?>
<td align="center"><?php echo $rsOrgData[0]->db_Orgname;?></td>
<td align="center"><?php echo $valuser->startdate.'<br />'.$valuser->enddate;?></td>
<td align="left"><?php echo $valuser->description;?></td>
<td align="center"><?php echo $valuser->spoint."-".$valuser->epoint;?></td>
<td align="left"><?php echo $valuser->comment;?></td>
<td align="center"><a href="<?php echo base_url()?>index.php/beatleAdmin/manageoffers/editstatus/<?php echo $valuser->offerid;?>/<?php if($valuser->active =='Y') echo 'N'; else echo 'Y';?>"><?php if($valuser->active =='Y') echo '<i style="font-size:30px;color:#249c27;" class="fa fa-check" aria-hidden="true"></i>'; else echo '<i style="font-size:30px;color:#a72b29;" class="fa fa-times" aria-hidden="true"></i>';?></a></td>
<!--<td align="left"><?php if($valuser->onhold =='Y') echo 'Unhold'; else echo 'Hold';?></td> -->
<td align="center"><a href="<?php echo base_url()?>index.php/beatleAdmin/manageoffers/editonhold/<?php echo $valuser->offerid;?>/<?php if($valuser->onhold =='Y') echo 'N'; else echo 'Y';?>"><?php if($valuser->onhold =='Y') echo '<i style="font-size:30px;color:#249c27;" class="fa fa-check" aria-hidden="true"></i>'; else echo '<i style="font-size:30px;color:#a72b29;" class="fa fa-times" aria-hidden="true"></i>';?></a></td>
<td align="center"><?php //echo $valuser->prod_image;
$this->Admin_model->fetchOfferImage($valuser->offer_image,60,90,'border:1px solid #ddd; padding:4px; text-align:center;box-shadow:1px 2px 5px #999;');
?></td>
<td align="center" style="max-width:50px !important;">
<ul class="nav navbar-right panel_toolbox">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="manageoffers/edit/<?php echo $valuser->offerid;?>">Edit</a>
</li>
<li><a href="javascript:;" class="deluser" data-uid="<?php echo $valuser->offerid;?>">Delete</a>
</li>
</ul>
</li>
</li>
</ul></td>
</tr>
<?php
//}
}
}
?>
</tbody>
</table>
</div>
<!-----------------------// new theme------------------------------------->
<div class="x_panel" style="display:none;">
<div class="x_title">
<h2>Offers List<small></small></h2>
<!-- <ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Settings 1</a>
</li>
<li><a href="#">Settings 2</a>
</li>
</ul>
</li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul> -->
<div class="clearfix"></div>
</div>
<div class="x_content">
<table id="datatable" class="table table-striped table-bordered">
<thead>
<tr>
<th style="max-width:200px !important;" >UniqueID</th>
<th>Title</th>
<th>Client</th>
<th>Dates</th>
<th>Description</th>
<th>Points between</th>
<th>Comments</th>
<th>status</th>
<th>on hold</th>
<th>Banner</th>
<th style="max-width:50px !important;">Action</th>
</tr>
</thead>
<tbody>
<?php
if (empty($productData)){ ?>
<tr class="ng-hide">
<td colspan="13"><h1 class="text-center text-muted ng-scope">No any data found.</h1><!-- end ngIf: !UsersList.ui.loading --></td>
</tr>
<?php } else {
foreach ($productData as $keyuser=>$valuser){
//echo "<pre>";
//print_r($productData);
//echo "</pre>";
//if ($valuser->db_usertype != 'SU_admin')
//{
?>
<tr id="rowid_<?php echo $valuser->offerid;?>">
<td style="max-width:200px !important;" ><?php echo $valuser->offeruid;?></td>
<td align="left"><?php echo $valuser->title;?></td>
<?php
$rsOrgData = $this->Admin_model->getAllUsersownerByOrgId($valuser->orgid);
?>
<td align="center"><?php echo $rsOrgData[0]->db_Orgname;?></td>
<td align="center"><?php echo $valuser->startdate.'<br />'.$valuser->enddate;?></td>
<td align="left"><?php echo $valuser->description;?></td>
<td align="center"><?php echo $valuser->spoint."-".$valuser->epoint;?></td>
<td align="left"><?php echo $valuser->comment;?></td>
<td align="center"><a href="<?php echo base_url()?>index.php/beatleAdmin/manageoffers/editstatus/<?php echo $valuser->offerid;?>/<?php if($valuser->active =='Y') echo 'N'; else echo 'Y';?>"><?php if($valuser->active =='Y') echo '<i style="font-size:30px;color:#249c27;" class="fa fa-check" aria-hidden="true"></i>'; else echo '<i style="font-size:30px;color:#a72b29;" class="fa fa-times" aria-hidden="true"></i>';?></a></td>
<!--<td align="left"><?php if($valuser->onhold =='Y') echo 'Unhold'; else echo 'Hold';?></td> -->
<td align="center"><a href="<?php echo base_url()?>index.php/beatleAdmin/manageoffers/editonhold/<?php echo $valuser->offerid;?>/<?php if($valuser->onhold =='Y') echo 'N'; else echo 'Y';?>"><?php if($valuser->onhold =='Y') echo '<i style="font-size:30px;color:#249c27;" class="fa fa-check" aria-hidden="true"></i>'; else echo '<i style="font-size:30px;color:#a72b29;" class="fa fa-times" aria-hidden="true"></i>';?></a></td>
<td align="center"><?php //echo $valuser->prod_image;
$this->Admin_model->fetchOfferImage($valuser->offer_image,60,90,'border:1px solid #ddd; padding:4px; text-align:center;box-shadow:1px 2px 5px #999;');
?></td>
<td align="center" style="max-width:50px !important;">
<ul class="nav navbar-right panel_toolbox">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="manageoffers/edit/<?php echo $valuser->offerid;?>">Edit</a>
</li>
<li><a href="javascript:;" class="deluser" data-uid="<?php echo $valuser->offerid;?>">Delete</a>
</li>
</ul>
</li>
</li>
</ul></td>
</tr>
<?php
//}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php }
else if($this->uri->segment(3) == 'add' || $this->uri->segment(3) == 'edit') { ?>
<div class="right_col" role="main">
<div class="">
<?php
$msgArr = array("success","img_size_error","title_taken","img_ext_error","img_not_copied");
$segment = $this->uri->segment(4);
if(!empty($segment)) {
if(in_array($this->uri->segment(4),$msgArr)){
$message = $this->uri->segment(4);
}
}
?>
<div class="row">
<?php if (!empty($message) && $message == 'img_size_error'){ ?>
<div class="error_div">
Banner size suhould be match with our criteria ( Height 400 to 500) X ( Width 1000 to 1200)
.
</div>
<?php } else if (!empty($message) && $message == 'title_taken'){?>
<div class="error_div">
Title has been taken, please try again with different title.
</div>
<?php } else if (!empty($message) && $message == 'img_ext_error'){?>
<div class="error_div">
Please select image from slected format only.(jpg, jpeg, png)
</div>
<?php }else if (!empty($message) && $message == 'success'){ ?>
<div class="success_div">
Offer banner added successfuly.
</div>
<?php } ?>
<div class="col-md-12 col-sm-12 col-xs-12">
<!--------new-theme---->
<h1 class="sub-model"><?php echo ucfirst($this->uri->segment(3))?> new offers </h1>
<form class="form-horizontal form-label-left" novalidate name="createUserForm" method="post" id="createUserForm" action="" enctype="multipart/form-data" >
<?php
// echo "<pre>";
// print_r($data);
// echo "</pre>";
$orgname = "";
$mainOrgId = "";
$orgid_edit = "";
$title = "";
$spoint = "";
$epoint = "";
$description = "";
$startdate = "";
$comment = "";
$name = "";
$points = "";
$stock = "";
if($this->uri->segment(3) == 'add'){
echo '<input type="hidden" name="actionfollow" value="addnewproducts" >';
}else if($this->uri->segment(3) == 'edit'){
//print_r($productData);
$orgid = "";
$orgid = $productData[0]->orgid;
$rsOrgData = $this->Admin_model->getAllUsersownerByOrgId($orgid);
$orgname = $rsOrgData[0]->db_Orgname;
$mainOrgId = $orgid;
$orgid_edit = $orgid;
$title = $productData[0]->title;
$spoint = $productData[0]->spoint;
$epoint = $productData[0]->epoint;
$description = $productData[0]->description;
$startdate = date("m/d/Y",strtotime($productData[0]->startdate))." - ".date("m/d/Y",strtotime($productData[0]->enddate));
$comment = $productData[0]->comment;
echo '<input type="hidden" name="actionfollow" value="editproducts" >';
echo '<input type="hidden" name="productid" value="'.$productData[0]->offerid.'" >';
}
if(isset($data)){
$orgname = $data['orgname'];
$mainOrgId = $data['mainOrgId'];
$orgid_edit = $data['orgid_edit'];
$title = $data['title'];
$spoint = $data['spoint'];
$epoint = $data['epoint'];
$description = $data['description'];
//$startdate = $data['startdate'];
$startdate = date("m/d/Y",strtotime($data['startdate']))." - ".date("m/d/Y",strtotime($data['enddate']));
$comment = $data['comment'];
}
?>
<!-- <span class="section">Personal Info</span>-->
<div class="item form-group" style="" id="ownerDiv">
<label for="addUserPassword" class="control-label col-md-3">Organization Name</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" name="orgname" id="orgname" autocomplete="off" required="required" placeholder="Select organization name" class="form form-control ng-pristine ng-untouched ng-invalid ng-invalid-required ng-valid-pattern" value="<?php echo $orgname?>" >
<input type="hidden" name="mainOrgId" id="mainOrgId" value="<?php echo $mainOrgId?>">
<input type="hidden" name="orgid_edit" id="orgid_edit" value="<?php echo $orgid_edit?>">
<div id="dataajaxorg"></div>
<div id="ownerload" style="display:none;">
<img src="<?php echo base_url();?>assets/img/loader.gif" width="30">
</div>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Title <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="title" name="title" autocomplete="off" required="required" class="form-control col-md-7 col-xs-12" value="<?php echo $title?>" placeholder="Title of the offer">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="addUserEmail2">Description<span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<!--<input type="number" value="" placeholder="Stocks. e.g. 10, 25, 10 ..."> -->
<textarea id="description" name="description" autocomplete="off" placeholder="Offer description at here" required="required" class="form-control col-md-7 col-xs-12"><?php echo $description?></textarea>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="startdate">Date between<span class="required">* </span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input class="form-control has-feedback-left col-md-7 col-xs-12" value="<?php echo $startdate?>" id="startdate" name="startdate" data-validate-linked="startdate" type="text" required="required">
<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>
<span id="" class="sr-only">(success)</span>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Points between <span class="required">*</span></label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="number" id="spoint" name="spoint" autocomplete="off" required="required" class="form-control col-md-3 col-xs-12" value="<?php echo $spoint?>" placeholder="Starting point">
</div>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="number" id="epoint" name="epoint" autocomplete="off" required="required" class="form-control col-md-3 col-xs-12" value="<?php echo $epoint?>" placeholder="Ending points">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="comment">Comments<!--<span class="required">*</span> --></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<!--<input type="number" value="" placeholder="Stocks. e.g. 10, 25, 10 ..."> -->
<textarea id="comment" name="comment" autocomplete="off" placeholder="Write a comment at here for our purpose only" class="form-control col-md-7 col-xs-12"><?php echo $comment?></textarea>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="offerimage">Offer banner<span class="required">*</span></label>
<div class=" label-sub col-md-6 col-sm-6 col-xs-12">
<input type="file" name="productImage" id="productImage" />
<span> ( Height 400 to 500) X ( Width 1000 to 1200) </span>
</div>
</div>
<?php if($this->uri->segment(3) == 'edit'){ ?>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<?php
if(!empty($productData[0]->prod_image))
{
$this->Admin_model->fetchProductsImage($productData[0]->prod_image,100,200,'border:1px solid #ddd; padding:4px;width:100px; margin-top:20px;');
}
?>
</div>
</div>
<?php } ?>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<button type="submit" class="btn btn-primary">Cancel</button>
<input type="submit" class="btn btn-success" <?php if (!empty($productData)){echo 'name="editusersubmit" id="editusersubmit"';}else{ echo 'name="addusersubmit" id="addusersubmit"';}?> value="Submit">
</div>
</div>
</form>
<!-------// new theme---------->
<div class="x_panel" style="display:none;">
<div class="x_title">
<h2><?php echo ucfirst($this->uri->segment(3))?> new offers --- </h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<form class="form-horizontal form-label-left" novalidate name="createUserForm" method="post" id="createUserForm" action="" enctype="multipart/form-data" >
<?php
// echo "<pre>";
// print_r($data);
// echo "</pre>";
$orgname = "";
$mainOrgId = "";
$orgid_edit = "";
$title = "";
$spoint = "";
$epoint = "";
$description = "";
$startdate = "";
$comment = "";
$name = "";
$points = "";
$stock = "";
if($this->uri->segment(3) == 'add'){
echo '<input type="hidden" name="actionfollow" value="addnewproducts" >';
}else if($this->uri->segment(3) == 'edit'){
//print_r($productData);
$orgid = "";
$orgid = $productData[0]->orgid;
$rsOrgData = $this->Admin_model->getAllUsersownerByOrgId($orgid);
$orgname = $rsOrgData[0]->db_Orgname;
$mainOrgId = $orgid;
$orgid_edit = $orgid;
$title = $productData[0]->title;
$spoint = $productData[0]->spoint;
$epoint = $productData[0]->epoint;
$description = $productData[0]->description;
$startdate = date("m/d/Y",strtotime($productData[0]->startdate))." - ".date("m/d/Y",strtotime($productData[0]->enddate));
$comment = $productData[0]->comment;
echo '<input type="hidden" name="actionfollow" value="editproducts" >';
echo '<input type="hidden" name="productid" value="'.$productData[0]->offerid.'" >';
}
if(isset($data)){
$orgname = $data['orgname'];
$mainOrgId = $data['mainOrgId'];
$orgid_edit = $data['orgid_edit'];
$title = $data['title'];
$spoint = $data['spoint'];
$epoint = $data['epoint'];
$description = $data['description'];
//$startdate = $data['startdate'];
$startdate = date("m/d/Y",strtotime($data['startdate']))." - ".date("m/d/Y",strtotime($data['enddate']));
$comment = $data['comment'];
}
?>
<!-- <span class="section">Personal Info</span>-->
<div class="item form-group" style="" id="ownerDiv">
<label for="addUserPassword" class="control-label col-md-3">Organization Name</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" name="orgname" id="orgname" autocomplete="off" required="required" placeholder="Select organization name" class="form form-control ng-pristine ng-untouched ng-invalid ng-invalid-required ng-valid-pattern" value="<?php echo $orgname?>" >
<input type="hidden" name="mainOrgId" id="mainOrgId" value="<?php echo $mainOrgId?>">
<input type="hidden" name="orgid_edit" id="orgid_edit" value="<?php echo $orgid_edit?>">
<div id="dataajaxorg"></div>
<div id="ownerload" style="display:none;">
<img src="<?php echo base_url();?>assets/img/loader.gif" width="30">
</div>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Title <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="title" name="title" autocomplete="off" required="required" class="form-control col-md-7 col-xs-12" value="<?php echo $title?>" placeholder="Title of the offer">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="addUserEmail2">Description<span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<!--<input type="number" value="" placeholder="Stocks. e.g. 10, 25, 10 ..."> -->
<textarea id="description" name="description" autocomplete="off" placeholder="Offer description at here" required="required" class="form-control col-md-7 col-xs-12"><?php echo $description?></textarea>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="startdate">Date between<span class="required">* </span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input class="form-control has-feedback-left col-md-7 col-xs-12" value="<?php echo $startdate?>" id="startdate" name="startdate" data-validate-linked="startdate" type="text" required="required">
<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>
<span id="" class="sr-only">(success)</span>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Points between <span class="required">*</span></label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="number" id="spoint" name="spoint" autocomplete="off" required="required" class="form-control col-md-3 col-xs-12" value="<?php echo $spoint?>" placeholder="Starting point">
</div>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="number" id="epoint" name="epoint" autocomplete="off" required="required" class="form-control col-md-3 col-xs-12" value="<?php echo $epoint?>" placeholder="Ending points">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="comment">Comments<!--<span class="required">*</span> --></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<!--<input type="number" value="" placeholder="Stocks. e.g. 10, 25, 10 ..."> -->
<textarea id="comment" name="comment" autocomplete="off" placeholder="Write a comment at here for our purpose only" class="form-control col-md-7 col-xs-12"><?php echo $comment?></textarea>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="offerimage">Offer banner<span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="file" name="productImage" id="productImage" />
<span> ( Height 400 to 500) X ( Width 1000 to 1200) </span>
</div>
</div>
<?php if($this->uri->segment(3) == 'edit'){ ?>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<?php
if(!empty($productData[0]->prod_image))
{
$this->Admin_model->fetchProductsImage($productData[0]->prod_image,100,200,'border:1px solid #ddd; padding:4px;width:100px; margin-top:20px;');
}
?>
</div>
</div>
<?php } ?>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<button type="submit" class="btn btn-primary">Cancel</button>
<input type="submit" class="btn btn-success" <?php if (!empty($productData)){echo 'name="editusersubmit" id="editusersubmit"';}else{ echo 'name="addusersubmit" id="addusersubmit"';}?> value="Submit">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php }else if($this->uri->segment(3) == 'requestlist') { ?>
<div class="right_col" role="main">
<div class="">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Offers/Advertise Request List<small></small></h2>
<!-- <ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Settings 1</a>
</li>
<li><a href="#">Settings 2</a>
</li>
</ul>
</li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul> -->
<div class="clearfix"></div>
</div>
<div class="x_content">
<table id="datatable" class="table table-striped table-bordered">
<thead>
<tr>
<th>Title</th>
<th>Client</th>
<th>Dates</th>
<th>Description</th>
<th>Points between</th>
<th>Status</th>
<th>Banner</th>
<th style="max-width:50px !important;">Action</th>
</tr>
</thead>
<tbody>
<?php
if (empty($requestlist)){ ?>
<tr class="ng-hide">
<td colspan="13"><h1 class="text-center text-muted ng-scope">No any data found.</h1><!-- end ngIf: !UsersList.ui.loading --></td>
</tr>
<?php } else {
foreach ($requestlist as $keyuser=>$valuser){
//echo "<pre>";
//print_r($productData);
//echo "</pre>";
//if ($valuser->db_usertype != 'SU_admin')
//{
$styleColor = '';
if($valuser->accept == 'yes'){
$styleColor = 'background:#cfecda;';
}
?>
<tr style="<?php echo $styleColor; ?>" id="rowid_<?php echo $valuser->offertempid;?>">
<!--<td style="max-width:200px !important;" ><?php echo $valuser->offertempid;?></td> -->
<td align="left"><?php echo $valuser->title;?></td>
<?php
$rsOrgData = $this->Admin_model->getAllUsersownerByOrgId($valuser->orgid);
?>
<td align="center"><?php echo $rsOrgData[0]->db_Orgname;?></td>
<td align="center"><?php echo $valuser->startdate.'<br />'.$valuser->enddate;?></td>
<td align="left"><?php echo $valuser->description;?></td>
<td align="center"><?php echo $valuser->spoint."-".$valuser->epoint;?></td>
<td align="center"><a href="<?php echo base_url()?>index.php/beatleAdmin/manageoffers/editstatus/<?php echo $valuser->offertempid;?>/<?php if($valuser->accept =='yes')
echo 'no'; else echo 'yes';?>"><?php if($valuser->accept =='yes') echo '<i style="font-size:30px;color:#249c27;" class="fa fa-check" aria-hidden="true"></i>'; else echo '<i style="font-size:30px;color:#a72b29;" class="fa fa-times" aria-hidden="true"></i>';?></a></td>
<td align="center">
<img style=" border:1px solid #ddd; padding:4px; text-align:center;box-shadow:1px 2px 5px #999;" height="60" width="90" alt="No image found" src="<?php echo BANNER_PATH.$valuser->offer_image;?>" class="headerImg">
</td>
<td align="center" style="max-width:50px !important;">
<?php if($styleColor == '') { ?>
<ul class="nav navbar-right panel_toolbox">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="<?php echo base_url();?>index.php/beatleAdmin/manageoffers/requestlistedit/<?php echo $valuser->offertempid;?>">Edit</a>
</li>
<li><a href="javascript:;" class="deluser" data-uid="<?php echo $valuser->offertempid;?>">Delete</a>
</li>
</ul>
</li>
</li>
</ul>
<?php } ?>
</td>
</tr>
<?php
//}
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<?php }else if($this->uri->segment(3) == 'requestlistedit' && $this->uri->segment(4) != '' && $this->uri->segment(4) != 0) { ?>
<div class="right_col" role="main">
<div class="">
<?php
$segment = $this->uri->segment(4);
if(!empty($segment)) {
if(in_array($this->uri->segment(4),$msgArr)){
$message = $this->uri->segment(4);
}
}
?>
<div class="row">
<?php if (!empty($message) && $message == 'img_size_error'){ ?>
<div class="error_div">
Banner size suhould be match with our criteria ( Height 400 to 500) X ( Width 1000 to 1200).
</div>
<?php } else if (!empty($message) && $message == 'title_taken'){?>
<div class="error_div">
Title has been taken, please try again with different title.
</div>
<?php } else if (!empty($message) && $message == 'img_ext_error'){?>
<div class="error_div">
Please select image from slected format only.(jpg, jpeg, png)
</div>
<?php }else if (!empty($message) && $message == 'success'){ ?>
<div class="success_div">
Offer banner added successfuly.
</div>
<?php } ?>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Manage offer/advertisement request </h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<form class="form-horizontal form-label-left" novalidate name="createUserForm" method="post" id="createUserForm" action="" enctype="multipart/form-data" >
<?php
// echo "<pre>";
// print_r($data);
// echo "</pre>";
$orgname = "";
$mainOrgId = "";
$orgid_edit = "";
$title = "";
$spoint = "";
$epoint = "";
$description = "";
$startdate = "";
$comment = "";
$name = "";
$points = "";
$stock = "";
$this->uri->segment(3);
if($this->uri->segment(3) == 'add'){
echo '<input type="hidden" name="actionfollow" value="addnewproducts" >';
}else if($this->uri->segment(3) == 'requestlistedit'){
//print_r($productData);
$orgid = "";
$orgid = $requestlist[0]->orgid;
$rsOrgData = $this->Admin_model->getAllUsersownerByOrgId($orgid);
$orgname = $rsOrgData[0]->db_Orgname;
$mainOrgId = $orgid;
$orgid_edit = $orgid;
$title = $requestlist[0]->title;
$spoint = $requestlist[0]->spoint;
$epoint = $requestlist[0]->epoint;
$status = $requestlist[0]->accept;
$description = $requestlist[0]->description;
$startdate = date("m/d/Y",strtotime($requestlist[0]->startdate))." - ".date("m/d/Y",strtotime($requestlist[0]->enddate));
$comment = "";
echo '<input type="hidden" name="actionfollow" value="addfromtempdata" >';
echo '<input type="hidden" name="offertempid" id="offertempid" value="'.$requestlist[0]->offertempid.'" >';
}
echo '<input type="hidden" name="bannerlink" id="bannerlink" value="'.BANNER_PATH.$requestlist[0]->offer_image.'" >';
if(isset($data)){
$orgname = $data['orgname'];
$mainOrgId = $data['mainOrgId'];
$orgid_edit = $data['orgid_edit'];
$title = $data['title'];
$spoint = $data['spoint'];
$epoint = $data['epoint'];
$description = $data['description'];
//$startdate = $data['startdate'];
$startdate = date("m/d/Y",strtotime($data['startdate']))." - ".date("m/d/Y",strtotime($data['enddate']));
$comment = $data['comment'];
}
?>
<script>
$(document).ready(function(e) {
$("#status").change(function(){
var st = $("#status").val();
if(st == 'yes')
$("#pushoffers").show();
else
$("#pushoffers").hide();
})
});
</script>
<div class="item form-group" style="" id="offerstatus">
<label for="addUserPassword" class="control-label col-md-3">STATUS</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<!--<input type="text" name="orgname" id="orgname_" readonly="readonly" autocomplete="off" required="required" placeholder="Select organization name" class="form form-control ng-pristine ng-untouched ng-invalid ng-invalid-required ng-valid-pattern" value="<?php echo $orgname?>" > -->
<select onchange="javascript" id="status" name="status" class="form form-control ng-pristine ng-untouched ng-invalid ng-invalid-required ng-valid-pattern">
<option <?php if($status == 'new') echo 'selected="selected"';?> value="waiting">New</option>
<option <?php if($status == 'waiting') echo 'selected="selected"';?> value="waiting">Waiting</option>
<option <?php if($status == 'yes') echo 'selected="selected"';?> value="yes">Approved</option>
<option <?php if($status == 'no') echo 'selected="selected"';?> value="no">Decline</option>
<option <?php if($status == 'hold') echo 'selected="selected"';?> value="no">Hold</option>
</select>
</div>
</div>
<?php
$stylPush = 'display:none;';
if($status == 'yes'){
$stylPush = '';
}
?>
<div class="item form-group" style=" <?php echo $stylPush; ?>" id="pushoffers">
<label for="addUserPassword" class="control-label col-md-3">Push into offers</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select style="background:#FFC;" class="form form-control ng-pristine ng-untouched ng-invalid ng-invalid-required ng-valid-pattern">
<option <?php if($status == 'yes') echo 'selected="selected"';?> value="waiting">Yes</option>
<option <?php if($status == 'no') echo 'selected="selected"';?> value="waiting">No</option>
</select>
</div>
</div>
<div class="item form-group" style="" id="ownerDiv">
<label for="addUserPassword" class="control-label col-md-3">Organization Name</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" name="orgname" id="orgname_" readonly="readonly" autocomplete="off" required="required" placeholder="Select organization name" class="form form-control ng-pristine ng-untouched ng-invalid ng-invalid-required ng-valid-pattern" value="<?php echo $orgname?>" >
<input type="hidden" name="mainOrgId" id="mainOrgId" value="<?php echo $mainOrgId?>">
<input type="hidden" name="orgid_edit" id="orgid_edit" value="<?php echo $orgid_edit?>">
<div id="dataajaxorg"></div>
<div id="ownerload" style="display:none;">
<img src="<?php echo base_url();?>assets/img/loader.gif" width="30">
</div>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Title <span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="title" name="title" autocomplete="off" required="required" class="form-control col-md-7 col-xs-12" value="<?php echo $title?>" placeholder="Title of the offer">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="addUserEmail2">Description<span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<!--<input type="number" value="" placeholder="Stocks. e.g. 10, 25, 10 ..."> -->
<textarea id="description" name="description" autocomplete="off" placeholder="Offer description at here" required="required" class="form-control col-md-7 col-xs-12"><?php echo $description?></textarea>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="startdate">Date between<span class="required">* </span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input class="form-control has-feedback-left col-md-7 col-xs-12" value="<?php echo $startdate?>" id="startdate" name="startdate" data-validate-linked="startdate" type="text" required="required">
<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>
<span id="" class="sr-only">(success)</span>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Stocks">Points between <span class="required">*</span></label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="number" id="spoint" name="spoint" autocomplete="off" required="required" class="form-control col-md-3 col-xs-12" value="<?php echo $spoint?>" placeholder="Starting point">
</div>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="number" id="epoint" name="epoint" autocomplete="off" required="required" class="form-control col-md-3 col-xs-12" value="<?php echo $epoint?>" placeholder="Ending points">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="comment">Comments<!--<span class="required">*</span> --></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<!--<input type="number" value="" placeholder="Stocks. e.g. 10, 25, 10 ..."> -->
<textarea id="comment" name="comment" autocomplete="off" placeholder="Write a comment at here for our purpose only" class="form-control col-md-7 col-xs-12"><?php echo $comment?></textarea>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12"> Banner </label>
<div class="col-md-6 col-sm-6 col-xs-12">
<img style=" border:1px solid #ddd; padding:4px; text-align:center;box-shadow:1px 2px 5px #999;" height="50%" width="50%" alt="No image found" src="<?php echo BANNER_PATH.$requestlist[0]->offer_image;?>" class="headerImg">
</div>
</div>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<button type="submit" class="btn btn-primary">Cancel</button>
<input type="submit" class="btn btn-success" <?php if (!empty($productData)){echo 'name="editusersubmit" id="editusersubmit"';}else{ echo 'name="addusersubmit" id="addusersubmit"';}?> value="Submit">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<?php include ('include/footer.php'); ?>