OverLord Shell

Path : G:/PleskVhosts/jaincensus.com/macciaweb.ultraliant.com/businessforum/
File Upload :
Current File : G:/PleskVhosts/jaincensus.com/macciaweb.ultraliant.com/businessforum/userproducteview.php

<?php 
/*
@Purpose: Add Product UI
@Author: Rajahree
@CreatedOn: 12 April 2016
@ModifiedOn: 12 April 2016
*/
session_start();

include("db/conn.php");
include_once("headerdash.inc.php");
include("sidebar.php");
if(!isset($_SESSION['company_id']) || !isset($_SESSION['company_name'])){session_destroy();header("location:login.php");}
if(!in_array($_SESSION['loggedin_user'],array('admin','company'))){header("location:404.php");}


$arrinfo = getData('busdir_product','product_id',base64_decode($_GET['id']),null,' and active="y" and deleted="n"');
//print_r($arrinfo);exit;

$arrinfo1 = getData('busdir_mst_all_company','my_company_id',$arrinfo['my_company_id'],null,'and active="y" and deleted="n"');
if(empty($arrinfo))header("location:404.php");

/*$arrphotoinfo = getData('busdir_product_photo','product_id',base64_decode($_GET['id']),null,"AND featured = 'y' AND active = 'y'");
$photopath = (!empty($arrphotoinfo['photo_path'])) ? $arrphotoinfo['photo_path'] : "no_image_available.jpg";*/
$companyid = (!empty($_SESSION['company_id'])) ? $_SESSION['company_id'] : null;
$webpagetitle="View Product";



?>
			
            
        <!--BEGIN CONTENT-->
        <section>

            <div class="second-page-container" style="padding-top: 30px;ba">
                <div class="container">
                    <div class="  row " >
                     <div class="col-md-8">
						<div class=" well col-lg-6 col-sm-6" style="width: 121%; border-top-color: red; border-top-width: 7px;">
   					<fieldset>
                       <legend><h4 class="wow fadeInRight animated" data-wow-duration="1s" style="color:red; padding-top:2%;">Edit Product</h4></legend>
                        <?php if(!empty($_GET['msg']) && strpos($_GET['msg'],'success')!=FALSE){?>
                            <div class="note note-success note-dismissable" id="msg">
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                <?php if($_GET['msg']=='add_success'){?>Record added Successfully<?php }?>
                                <?php if($_GET['msg']=='update_success'){?>Record updated Successfully<?php }?>
                                <?php if($_GET['msg']=='delete_success'){?>Record deleted Successfully<?php }?>
                            </div>
                            <?php }?>
                            <form role="form" id="updateform" enctype="multipart/form-data">
                            	<input type="hidden" name="product_id" id="product_id" value="<?php echo base64_decode($_GET['id']);?>">
                            	<div class="row">
                             
                                    <div class="col-sm-6">
                                           <div class="form-group">
                                            <label>Product Name <span class="require">*</span></label>
                                            <input type="text" class="form-control" name="product_name" id="product_name" value="<?php echo $arrinfo['product_name'];?>" maxlength="100" data-validation="required" data-validation-error-msg="Invalid Product Name" disabled="disabled">
                                        </div>
                                    </div>
                                   
                                   
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label>Company <span class="require">*</span></label>
                                           <?php 
										   $my=$arrinfo1['my_company_id'];
                                          $listq1="SELECT * FROM busdir_mst_all_company where  active='y' and deleted='n'and company_id=$companyid ";
										//  echo $listq1;exit;
							$listr1=$connection->query($listq1);
							?>
                              <div class="form-group ">
							<select class="form-control" name="my_company_id" id="company_name">
                           <?php /*?> <option value="<?php $arrinfo['my_company_id'];?>"><?php echo $arrinfo['company_name'];?></option><?php */?>
							<?php
							while($listrow1=$listr1->fetch_assoc()){
							
                            if ($arrinfo['my_company_id']== $listrow1['my_company_id']) { 
                                $selected = 'selected="selected"';  
                               }?>
							<option style="width: 98%;" value="<?php echo $listrow1['my_company_id'];?>"><?php echo $listrow1['company_name'];?>
                            </option>
							<?php
							}?></select>
                                        </div>
                                    </div>
                                  
                               </div>
                               
							     </div>
								 <div class="row">
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label>Category <span class="require">*</span></label>
                                             <?php echo getDropDown('catid','busdir_mst_category','categoryname','catid','active="y"',$arrinfo['catid'],'onChange=getSubcat()','valid=true'); ?>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
										<div class="form-group">
                                            <label>Subcategory</label>
                                            <?php echo getDropDown('subcatid','busdir_mst_subcategory','subcategoryname','subcatid','active="y"',$arrinfo['subcatid'],null,'valid=true'); ?>
                                        </div>
                                    </div>
                               </div>
							   <div class="row">
                               <div class="col-sm-2">
                                        <div class="form-group">
                                          
                                                <label>currency </label>
                                             <?php echo getDropDown('currency_id','busdir_mst_currency','symbol','symbol','active="y" group by symbol',$arrinfo['currency'],'valid=true','form-control'); ?>
                                         
                                        </div>
                                	</div>
                                    <div class="col-sm-4">
                                        <div class="form-group">
                                            <label>Price <span class="require">*</span></label>
                                            
                                            	<input type="number" style="    margin-left: -31px;  width: 296px;"  class="form-control"step="0.01" name="price" id="price" value="<?php echo $arrinfo['price'];?>" maxlength="11" data-validation="" data-validation-error-msg="Invalid price" required="required">
                                       </div>
                                    </div>
									
                                   	<div class="col-sm-6">
										<div class="form-group">
                                            <label>Discounted Price</label>
                                           
                                                <input type="number" step="0.01" style="width:385px" class="form-control" name="discounted_price" id="discounted_price" value="<?php echo $arrinfo['discounted_price'];?>" maxlength="11" data-validation="" data-validation-error-msg="Invalid discounted price" data-validation-optional="true" required="required">
                                            
                                        </div>
                                    </div>
									
                            </div>
							<div class="row">
                             		<div class="col-sm-6">
                                        <div class="form-group">
                                        	<label>Image Size (500kb)</label>
                                            <div class="input-group">
                                            	<input type="file" name="catlog" id="catlog" class="form-control" data-validation="<?=$required;?> mime size" data-validation-allowing="jpg, png, gif" data-validation-max-size="500000" data-validation-error-msg="Invalid Image">
                                              	<?php if(!is_null($arrinfo['catlog'])){?><a href="<?php echo $arrinfo['catlog'];?>" class="fancybox input-group-addon" title="Existing Image" target="_blank"><i class="fa fa-eye"></i></a><?php }?>
                                        	</div>
                                    	</div>
                                	</div>
                            	
                            	
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label>Description</label>
                                           	<textarea class="form-control" name="description" id="description" rows="5" maxlength="3000" data-validation="required" data-validation-error-msg="Invalid Description" data-validation-optional="true"><?php echo $arrinfo['description'];?></textarea>
                                        </div>
                                    </div>
                                </div>
								
                                <div class="note note-danger displaynone"></div>
									<div style="float:right;">
                                <button type="submit" class="btn btn-primary" data-loading-text="Submitting...">Save</button> <button type="reset" class="btn btn-default" onClick="$('.note-danger').hide()">Reset</button>
                                <a href="javascript:void(0)" class="btn btn-link" onclick="history.back()"><i class="fa fa-angle-left mrm"></i>Go Back</a>
								</div>
                            </form>
                            </fieldset>
                        </div>
        
      </div><!--col-md-8-->
    </div>
    
    </div>
            
    
	</div>
	</div>

	
           
  </section>
        <!--END CONTENT-->
<link type="text/css" rel="stylesheet" href="css/jquery.fancybox.css">
<script src="js/jquery.fancybox.pack.js"></script>
<!--<script src="js/validate.js"></script>-->
<script>
$('.fancybox').fancybox();
$(document).ready(function() {
$(".btn-pref .btn").click(function () {
    $(".btn-pref .btn").removeClass("btn-primary").addClass("btn-default");
    // $(".tab").addClass("active"); // instead of this do the below 
    $(this).removeClass("btn-default").addClass("btn-primary");   
});
});
function valEdit() {

    $.validate({
        modules: 'file,security',
        form: '#updateform',
        scrollToTopOnError: false,
        onSuccess: function() {
			
            $('#updateform button[type=submit]').button('loading');
            $('#updateform button[type=reset]').attr('disabled', 'disabled');
            $('.alert-danger').html('').hide();
            $.ajax({
                type: 'POST',
                url:'userproductedit_save.php',
                data: new FormData($('#updateform')[0]),
                contentType: false,
                processData: false,
                success: function(data) {
				//alert(data);
                    if (data == 'success') {
						 $('.alert-danger').html(data).show();
                       location = 'userproduct.php?id=<?php echo  $_GET['id'];?>&msg=update_success';
                    } else if (data.substr(data.length - 4) == '.php') location = data;
                    else {
                        $('.alert-danger').html(data).show();
                        $('#updateform button[type=submit]').button('reset');
                        $('#updateform button[type=reset]').removeAttr('disabled');
                    }
                }
            });
            return false;
        }
    });
}
valEdit();
</script>

<?php include_once("footer.inc.php");connClose();?>

xRyukZ - Copyright 2k19