codeigniter edit delete view

0
18

<?php $this->load->view('admin/segments/header'); ?>
<?php $this->load->view('admin/segments/headertop'); ?>
<?php $this->load->view('admin/segments/headernav'); ?>

<script>
function go_href(m){
$.ajax({
type:"POST",
url:"<?=base_url("admin/freelancer/change_user_type")?>",
data:{type:m,id:<?=$query['user_id']?>},
beforSend:function(x){ },
success: function(data){ //alert(data);
$('#change_type').html(data);
}
});
}

$(function(){
var m = $('#utype').val();
$.ajax({
type:"POST",
url:"<?=base_url("admin/freelancer/change_user_type")?>",
data:{type:m,id:<?=$query['user_id']?>},
beforSend:function(x){ },
success: function(data){ //alert(data);
$('#change_type').html(data);
}
});
});
</script>

<div id="main" class="container_16" style="float:left; padding:5px; margin-top:20px;">
<div class="grid_16">
<div id="content">
<div class="settings form">
<h2>Edit Freelancer <a href="javascript:history.go(-1)" class="add-sec" style="float:right"><strong>Back</strong></a></h2>

<?php if(isset($error)){?><div class="error"><?php echo $error; ?></div><?php }?>

<?php echo form_open(base_url("admin/freelancer/edit/$query[user_id]")); ?>

<form id="SettingAdminPrefixForm" name="addprog" method="post" enctype="multipart/form-data">
<fieldset>

<p style="width:98%; background:#FFCC99; border: 1px solid #DFDFDF; font-weight:bold; padding:10px;">User Details:</p>

<div class="setting">
<div class="input text" >
<label for="Setting0Value">User Type</label>
<select name="freelancer_type" id="utype" onchange="go_href(this.value);">
<option value="individual" <? if($query['freelancer_type']=="individual"){echo"selected";}?> >Individual</option>
<option value="company" <? if($query['freelancer_type']=="company"){echo"selected";}?> >Company</option>
</select>
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">First Name</label>
<input type="text" name="fname" value="<?=$query['first_name']?>" />
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Last Name</label>
<input type="text" name="lname" value="<?=$query['last_name']?>" />
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Profile Tag Line</label>
<input type="text" name="profile_tag_line" id="profile_tag_line" value="<?=$query['profile_tag_line']?>" />
</div>
</div>


<div class="setting">
<div class="input text">
<label for="Setting0Value">Profile Photo</label>
<input type="file" name="profile_photo" value="<?=$query['profile_photo']?>" />
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Hourly Rate ($)</label>
<select name="hourly_rate" id="hourly_rate">
<option value="">Select</option>
<? for($i=5;$i<=100; $i=$i+5){ ?>
<option value="<?=$i?>" <? if($i==$query['hourly_rate']){echo "SELECTED";}?> ><?=$i?></option>
<? } ?>
</select>
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Profile Description</label>
<textarea name="user_desc" id="user_desc" ><?=$query['user_desc']?></textarea>
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Service Category</label>
<ul class="form-list" style="margin-left:5px;">
<li>
<?php foreach ($service_cates as $s_cate) : ?>
<div style="width:172px; float:left">
<input type="checkbox" name="service_cates[]" id="service_cates_<?php echo $s_cate['id']; ?>" value="<?php echo $s_cate['id']; ?>"
<?php if(isset($_POST['service_cates'])) { echo (in_array($s_cate['id'], $_POST['service_cates']) ? 'checked="checked"' : ''); } ?> />
<?php echo $s_cate['name']; ?>
</div>
<?php endforeach ?>
</li>
</ul>
</div>
</div><br />
</fieldset>

<fieldset>
<div class="setting" id="skill_id">
<div class="input text">
<label for="Setting0Value">Skills</label>
<? $uu_sk=array(); foreach($user_sk as $u_skl){ $uu_sk[]=$u_skl->id;} ?>
<ul class="form-list" style="margin-left:5px;">
<li>
<?php foreach ($skills as $skill) : ?>
<div style="width:172px; float:left">
<input type="checkbox" name="skills[]" id="skill_<?php echo $skill->id; ?>" value="<?php echo $skill->id; ?>" <? if(in_array($skill->id,$uu_sk)){ echo "checked"; } ?> />
<?php echo $skill->name; ?>
</div>
<?php endforeach ?>
</li>
</ul>
</div>
</div>
</fieldset>

<fieldset>

<p style="width:98%; background:#FFCC99; border: 1px solid #DFDFDF; font-weight:bold; padding:10px; margin-top:10px;">Education Details:</p>

<div class="setting">
<div class="input text">
<label for="Setting0Value">School/College Name</label>
<input type="text" name="college_name" value="<?=$query['college_name']?>" />
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Date Attended</label>
<input type="text" name="date_attended" value="<?=$query['date_attended']?>" />
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Degree</label>
<input type="text" name="degree" value="<?=$query['degree']?>" />
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Area of Study</label>
<input type="text" name="area_of_study" value="<?=$query['area_of_study']?>" />
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Description</label>
<textarea name="edu_desc" id="edu_desc" ><?=$query['edu_desc']?></textarea>
</div>
</div>

<div id="change_type">
<p style="width:98%; background:#FFCC99; border: 1px solid #DFDFDF; font-weight:bold; padding:10px; margin-top:10px;">Contact Information:</p>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Address</label>
<input type="text" name="address" value="<?=$query['address']?>" />
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Country</label>
<select name="country" id="country">
<option value="">Select Country</option>
<? foreach($countries as $country){ ?>
<option value="<?=$country['id']?>" <? if($country['id']==$query['country']){echo "SELECTED";} ?> ><?=$country['countryname']?></option>
<? } ?>
</select>
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">State</label>
<? if($query['country']!=0){ $states = $this->freelancer_model->get_states($query['country']);} ?>
<select name="state" id="state">
<option value="" >Select State</option>
<? foreach($states as $state){ ?>
<option value="<?=$state['id']?>" ><?=$state['countryname']?></option>
<? }?>
</select>
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">City</label>
<? if($query['state']!=0){ $cities = $this->freelancer_model->get_cities($query['state']);} ?>
<select name="city" id="city">
<option value="" >Select City</option>
<? foreach($cities as $city){ ?>
<option value="<?=$city['id']?>" ><?=$city['countryname']?></option>
<? }?>
</select>
</div>
</div>

<div class="setting">
<div class="input text">
<label for="Setting0Value">Zipcode</label>
<input type="text" name="zipcode" id="zipcode" value="<?=$this->input->post('zipcode')?>" />
</div>
</div>
</div><!--change_type-->

<div class="setting">
<div class="input text">
<label for="Setting0Value">Status</label>
<select name="status" style="width:100px;">
<option value="1" <?php if($query['status']==1){echo "SELECTED";}?>>Active</option>
<option value="0" <?php if($query['status']==0){echo "SELECTED";}?>>Inactive</option>
</select>
</div>
</div>

<input type="hidden" name="user_type" value="freelancer" />

<div class="submit"><input type="submit" name="submit" value="Update" /></div>

</fieldset>

</form>
</div>
</div>
</div>
<div class="clear">&nbsp;</div>
</div>
<div class="push"></div>

<?php $this->load->view('admin/segments/footer'); ?>

<script>
/* Loading States by country id */
$('#country').live('change', function(){
var country_id= $(this).val(); //alert(country_id);
$.ajax({
type: "POST",
url: "<?php echo base_url();?>admin/freelancer/get_states",
data: {country_id:country_id},
success: function(msg){ //alert(msg);
$('#state').html(msg);
}
});
});
/* Loading Cities by state id */
$('#state').live('change', function(){
var state_id= $(this).val(); //alert(state_id);
$.ajax({
type: "POST",
url: "<?php echo base_url();?>admin/freelancer/get_cities",
data: {state_id:state_id},
success: function(msg){ //alert(msg);
$('#city').html(msg);
}
});
});

$(function(){
var country_id= $('#country').val(); //alert(country_id);
$.ajax({
type: "POST",
url: "<?php echo base_url();?>admin/freelancer/get_states",
data: {country_id:country_id,state:<?=$query['state']?>},
success: function(msg){ //alert(msg);
$('#state').html(msg);
}
});

var state_id= $('#state').val(); //alert(state_id);
$.ajax({
type: "POST",
url: "<?php echo base_url();?>admin/freelancer/get_cities",
data: {state_id:state_id,city:<?=$query['city']?>},
success: function(msg){ //alert(msg);
$('#city').html(msg);
}
});


});

</script>

LEAVE A REPLY

Please enter your comment!
Please enter your name here