Merge branch 'master' of https://bitbucket.org/venbainformationtechnology/apollodec
This commit is contained in:
commit
a31e094f3f
@ -30,6 +30,9 @@ class University_Controller extends REST_Controller {
|
||||
parent::__construct();
|
||||
$this->methods['getUniversity_post']['limit'] = 100;
|
||||
$this->methods['chkUnivIdExistDetail_post']['limit'] = 100;
|
||||
$this->methods['getDefaultActivityDetails_post']['limit'] = 100;
|
||||
$this->methods['updateDefaultActivityDetails_post']['limit'] = 100;
|
||||
|
||||
// load the university model
|
||||
$this->load->model('University_model', 'university_model');
|
||||
}
|
||||
@ -233,6 +236,63 @@ class University_Controller extends REST_Controller {
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* get default activity details
|
||||
* created by kms
|
||||
* */
|
||||
public function getDefaultActivityDetails_post()
|
||||
{
|
||||
$requestedBy = $this->post('requestedBy');
|
||||
$getDefaultActivity = $this->university_model->getDefaultActivity($requestedBy);
|
||||
if ($getDefaultActivity)
|
||||
{
|
||||
$getDefaultActivity['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getDefaultActivity, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{ // Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No records found!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
}
|
||||
/*
|
||||
* update default activity status
|
||||
* created by kms
|
||||
* */
|
||||
|
||||
public function updateDefaultActivityDetails_post()
|
||||
{
|
||||
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$details['StudentActivityCode'] = $this->post('activityID');
|
||||
$details['StatusCode'] = $this->post('activityName');
|
||||
//$details['IsActive'] = $this->post('status');
|
||||
$details['UpdatedBy'] = $this->post('updatedBy');
|
||||
$details['UpdatedOn'] = $now->format('Y-m-d H:i:s');
|
||||
$jsonData=$this->post('activityStatus');
|
||||
$activityDetails = $this->university_model->updateDefaultActivity($details,$jsonData);// Check if the users data store contains users (in case the database result returns NULL)
|
||||
|
||||
if ($activityDetails)
|
||||
{
|
||||
$activityDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($activityDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'Something went wrong.please try again!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -254,4 +254,115 @@ class University_model extends CI_Model
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
* get default activity details
|
||||
* created by kms
|
||||
* */
|
||||
public function getDefaultActivity()
|
||||
{
|
||||
$arr = array('ListGroup'=>2,'ListGroup'=>6);
|
||||
$this->db->distinct();
|
||||
$this->db->select('ListName,ListCode,IsActive');
|
||||
$this->db->order_by('ListName','ASC');
|
||||
$this->db->or_where('ListGroup','2');
|
||||
$this->db->or_where('ListGroup','6');
|
||||
$this->db->or_where('ListGroup','7');
|
||||
$this->db->or_where('ListGroup','8');
|
||||
$this->db->or_where('ListGroup','9');
|
||||
$defaultActivityDetails=$this->db->get(PICK_LIST_DETAILS);
|
||||
if($defaultActivityDetails->result()){
|
||||
$activity_result['activityStatus'] = true;
|
||||
foreach ($defaultActivityDetails->result() as $row){
|
||||
$result_array['ActivityID'] = $row->ListCode;
|
||||
$result_array['ActivityName'] = $row->ListName;
|
||||
$result_array['IsActive'] = $row->IsActive;
|
||||
$this->db->select('DA.StudentActivityCode,PLD.ListCode,PLD.ListName');
|
||||
$this->db->from(DEFAULTACTIVITY .' as DA');
|
||||
$this->db->join(PICK_LIST_DETAILS.' as PLD', 'PLD.ListCode = DA.StatusCode');
|
||||
$this->db->where('PLD.IsActive','1');
|
||||
$this->db->where('DA.IsActive','1');
|
||||
$this->db->where('DA.StudentActivityCode',$row->ListCode);
|
||||
$result_array['statusDetails']=$this->db->get()->result();
|
||||
$result[]=$result_array;
|
||||
}
|
||||
|
||||
$activity_result['details'] = $result;
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
$activity_result['activityStatus'] = false;
|
||||
$activity_result['details'] = "No records found!";
|
||||
}
|
||||
$activity_result['masterStatusList']=$this->getAllStatusList('1');
|
||||
return $activity_result;
|
||||
|
||||
}
|
||||
/*
|
||||
* update default activity status
|
||||
* created by kms
|
||||
* */
|
||||
public function updateDefaultActivity($arrayDetails=null,$jsonData=null) {
|
||||
|
||||
|
||||
$deactiveStatus['IsActive']=false;
|
||||
$deactiveStatus['UpdatedBy']=$arrayDetails['UpdatedBy'];
|
||||
$deactiveStatus['UpdatedOn']=$arrayDetails['UpdatedOn'];
|
||||
$this->db->where('StudentActivityCode ',$arrayDetails['StudentActivityCode']);
|
||||
$updateActivityStatusDeactive = $this->db->update(DEFAULTACTIVITY, $deactiveStatus);
|
||||
if($updateActivityStatusDeactive){
|
||||
|
||||
if($jsonData){
|
||||
|
||||
foreach ($jsonData as $urow){
|
||||
|
||||
$this->db->select('StatusCode');
|
||||
$this->db->where('StatusCode',$urow);
|
||||
$this->db->where('StudentActivityCode',$arrayDetails['StudentActivityCode']);
|
||||
if($this->db->get(DEFAULTACTIVITY)->first_row()){
|
||||
$existStatusUpdate['IsActive']=true;
|
||||
$existStatusUpdate['UpdatedBy']=$arrayDetails['UpdatedBy'];
|
||||
$existStatusUpdate['UpdatedOn']=$arrayDetails['UpdatedOn'];
|
||||
$this->db->where('StatusCode',$urow);
|
||||
$this->db->where('StudentActivityCode',$arrayDetails['StudentActivityCode']);
|
||||
$this->db->update(DEFAULTACTIVITY, $existStatusUpdate);
|
||||
}
|
||||
else{
|
||||
$update_array["StatusCode"]=$urow;
|
||||
$update_array["StudentActivityCode"]=$arrayDetails['StudentActivityCode'];
|
||||
$update_array["IsActive"]=true;
|
||||
$update_array["CreatedBy"]=$arrayDetails['UpdatedBy'];
|
||||
$update_array["CreatedOn"]=$arrayDetails['UpdatedOn'];
|
||||
$this->db->insert(DEFAULTACTIVITY, $update_array);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/*else{
|
||||
$activateStatus['IsActive']=true;
|
||||
$this->db->where('StudentActivityCode ',$arrayDetails['StudentActivityCode']);
|
||||
$this->db->update(DEFAULTACTIVITY, $activateStatus);
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
$result['activityStatus'] = true;
|
||||
$result['message'] = "Successfully status updated";
|
||||
}
|
||||
|
||||
|
||||
|
||||
else {
|
||||
$result['activityStatus'] = false;
|
||||
$result['message'] = "Something went wrong.please try again";
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
157
Apollo/assets/js/controllers/studentStatusUpdateCtrl.js
Normal file
157
Apollo/assets/js/controllers/studentStatusUpdateCtrl.js
Normal file
@ -0,0 +1,157 @@
|
||||
'use strict';
|
||||
/**
|
||||
* controllers for ng-table
|
||||
* Simple table with sorting and filtering on AngularJS
|
||||
*/
|
||||
// var helloApp = angular.module("helloApp", []);
|
||||
app.controller("studentStatusUpdateCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$localStorage", "$http", "$state", function ($scope, toaster, $filter, apiPoint, $localStorage, $http, $state) {
|
||||
|
||||
$scope.companies = {
|
||||
"ActivityID": "",
|
||||
"ActivityName": "",
|
||||
"switchsetting": true,
|
||||
|
||||
};
|
||||
/*
|
||||
* cancel edit div
|
||||
* created by kms
|
||||
* */
|
||||
$scope.cancel = function () {
|
||||
$scope.init();
|
||||
$scope.editId = -1;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
*get Activity details when page loading called from view file
|
||||
*
|
||||
* created by karthi
|
||||
* */
|
||||
$scope.statusList = [];
|
||||
$scope.loader = '';
|
||||
$scope.emptyData = '';
|
||||
$scope.init = function () {
|
||||
var getActivity = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'getDefaultActivityDetails/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
||||
}
|
||||
};
|
||||
$http(getActivity).then(function (response) {
|
||||
if (response.data.status == 200 && response.data.activityStatus) {
|
||||
$scope.statusList = [];
|
||||
$scope.emptyData = true;
|
||||
$scope.loader = true;
|
||||
$scope.activityInfo = response.data.details;
|
||||
$scope.masterActivityStatus=response.data.masterStatusList;
|
||||
angular.forEach($scope.masterActivityStatus, function (values, keys) {
|
||||
$scope.statusData = {
|
||||
name: values.ListName,
|
||||
id: values.ListCode
|
||||
};
|
||||
$scope.statusList.push($scope.statusData);
|
||||
})
|
||||
} else {
|
||||
$scope.statusList = [];
|
||||
$scope.emptyData = false;
|
||||
$scope.loader = false;
|
||||
$scope.activityInfo = "";
|
||||
$scope.masterActivityStatus=response.data.masterStatusList;
|
||||
angular.forEach($scope.masterActivityStatus, function (values, keys) {
|
||||
$scope.statusData = {
|
||||
name: values.ListName,
|
||||
id: values.ListCode
|
||||
};
|
||||
$scope.statusList.push($scope.statusData);
|
||||
})
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// sorting function for table params
|
||||
$scope.sort = function(keyname){
|
||||
$scope.sortKey = keyname; //set the sortKey to the param passed
|
||||
$scope.reverse = !$scope.reverse; //if true make it false and vice versa
|
||||
}
|
||||
|
||||
|
||||
$scope.editId = -1;
|
||||
$scope.setEditId = function (p) {
|
||||
$scope.editId = p.ActivityID;
|
||||
$scope.editStatusList = [];
|
||||
angular.forEach(p.statusDetails, function (values, keys) {
|
||||
|
||||
$scope.editStatusList.push(values.ListCode);
|
||||
})
|
||||
$scope.viewEditStatus = {
|
||||
list: $scope.editStatusList,
|
||||
}
|
||||
|
||||
};
|
||||
/*
|
||||
* update the default Activity details
|
||||
* created by kms
|
||||
* */
|
||||
$scope.updateActivity = function (myModel,listStatus, form, loading) {
|
||||
|
||||
var firstError = null;
|
||||
if (form.$invalid) {
|
||||
var field = null, firstError = null;
|
||||
for (field in form) {
|
||||
if (field[0] != '$') {
|
||||
if (firstError === null && !form[field].$valid) {
|
||||
firstError = form[field].$stop_name;
|
||||
}
|
||||
|
||||
if (form[field].$pristine) {
|
||||
form[field].$dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
||||
} else {
|
||||
$scope.ldloading3 = {};
|
||||
|
||||
$scope.ldloading3[loading.replace('-', '_')] = true;
|
||||
|
||||
|
||||
var update = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'updateDefaultActivityDetails/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
activityID: myModel.ActivityID,
|
||||
activityName: myModel.ActivityName,
|
||||
activityStatus:listStatus.list,
|
||||
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
|
||||
}
|
||||
};
|
||||
$http(update).then(function (response) {
|
||||
if (response.data.status==200 && response.data.activityStatus) {
|
||||
|
||||
$scope.ldloading3[loading.replace('-', '_')] = false;
|
||||
swal("Success!", response.data.message, "success");
|
||||
$scope.init();
|
||||
$scope.editId = -1;
|
||||
|
||||
|
||||
} else {
|
||||
$scope.ldloading3[loading.replace('-', '_')] = false;
|
||||
swal("Failed!", response.data.message, "error");
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}]);
|
||||
103
Apollo/assets/views/editDefaultActivityStatus.html
Normal file
103
Apollo/assets/views/editDefaultActivityStatus.html
Normal file
@ -0,0 +1,103 @@
|
||||
<form name="Form" id="form" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<fieldset>
|
||||
<legend>
|
||||
Update Status
|
||||
</legend>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.ListCode.$dirty && Form.ListCode.$invalid, 'has-success':Form.ListCode.$valid}">
|
||||
<label>
|
||||
Activity ID<span class="symbol required"></span>
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="Enter Activity ID" tabindex="1" class="form-control" name="ListCode" ng-model="p.ActivityID"
|
||||
readonly required/>
|
||||
<span class="error text-small block" ng-if="Form.ListCode.$dirty && Form.ListCode.$error.required">Activity ID is required</span>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.ListName.$dirty && Form.ListName.$invalid, 'has-success':Form.ListName.$valid}">
|
||||
<label>
|
||||
Activity Name <span class="symbol required"></span>
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="Enter Activity Name" tabindex="2" class="form-control" name="ListName" ng-model="p.ActivityName"
|
||||
readonly required/>
|
||||
<span class="error text-small block" ng-if="Form.ListName.$dirty && Form.ListName.$error.required">Activity name is required</span>
|
||||
<span class="error text-small block" ng-if="Form.ListName.$dirty && Form.ListName.$error.pattern">Invalid activity name </span>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error':Form.status.$dirty && Form.status.$invalid && viewEditStatus.list.length==0, 'has-success':Form.status.$valid}">
|
||||
<label >
|
||||
Status<span
|
||||
class="symbol required"></span>
|
||||
</label>
|
||||
|
||||
<ui-select multiple ng-model="viewEditStatus.list" tabindex="4">
|
||||
<ui-select-match placeholder="Select Status">
|
||||
{{$item.name}}
|
||||
</ui-select-match>
|
||||
<ui-select-choices
|
||||
repeat="d.id as d in statusList | filter:$select.search">
|
||||
{{d.name}}
|
||||
</ui-select-choices>
|
||||
</ui-select>
|
||||
|
||||
<input class="ng-hide" type="text" name="status"
|
||||
ng-model="viewEditStatus.list"
|
||||
required>
|
||||
<span class="error text-small block"
|
||||
ng-if="Form.status.$dirty && Form.status.$error.required && viewEditStatus.list.length==0">Status is required.</span>
|
||||
<!--<span class="success text-small block"-->
|
||||
<!--ng-if="Form.subjects.$valid && myModel.subjects.length!=0">Thank You</span>-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
|
||||
<!--<div class="col-md-4">
|
||||
<label>
|
||||
Active/De-Active
|
||||
</label>
|
||||
<div ng-if="p.IsActive==true">
|
||||
|
||||
<switch ng-model="p.IsActive" ng-init="p.IsActive = true" class="green"></switch>
|
||||
|
||||
</div>
|
||||
<div ng-if="p.IsActive==false">
|
||||
<switch ng-model="p.IsActive" ng-init="p.IsActive = false" class="green"></switch>
|
||||
|
||||
</div>
|
||||
|
||||
</div>-->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<button type="submit" ladda="ldloading3.zoom_in" tabindex="2" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="updateActivity(p,viewEditStatus,Form,'zoom-in')">
|
||||
Save
|
||||
</button>
|
||||
|
||||
<input type="button" class="btn btn-warning btn-wide" tabindex="3" value="Cancel" ng-click="cancel();">
|
||||
|
||||
</input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- class="editRowTd" -->
|
||||
77
Apollo/assets/views/studentStatusUpdate.html
Normal file
77
Apollo/assets/views/studentStatusUpdate.html
Normal file
@ -0,0 +1,77 @@
|
||||
<style>
|
||||
b.fa {
|
||||
display: inline-block;
|
||||
border-radius: 60px;
|
||||
box-shadow: 0px 0px 2px #007AFF;
|
||||
padding: 0.5em 0.6em;
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
<section id="page-title">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<h1 class="mainTitle" translate="Default Student Activity Details"></h1>
|
||||
<!--
|
||||
<span class="mainDescription">Over a dozen reusable components built to provide popovers, media objects, navigation, tooltips and much more. </span>
|
||||
-->
|
||||
</div>
|
||||
<div ncy-breadcrumb></div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="container-fluid container-fullw bg-white">
|
||||
<div ng-controller="studentStatusUpdateCtrl">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3">
|
||||
<script>
|
||||
$(function () {
|
||||
$("#search").focus();
|
||||
|
||||
});
|
||||
</script>
|
||||
<input class="form-control" type="text" ng-model="search"
|
||||
id="search" autofocus tabindex="5"
|
||||
placeholder="Search"/><br><br>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<table class="table table-hover" ng-init="init();">
|
||||
<thead>
|
||||
<tr>
|
||||
<th ng-click="sort('ActivityID')">Activity ID
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='ActivityID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"> </span>
|
||||
</th>
|
||||
<th ng-click="sort('ActivityName')">Activity Name
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='ActivityName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"> </span>
|
||||
|
||||
</th>
|
||||
<th></th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody dir-paginate="p in activityInfo|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:10">
|
||||
<tr>
|
||||
<td>{{p.ActivityID}}</td>
|
||||
<td>{{p.ActivityName}}</td>
|
||||
|
||||
<td>
|
||||
<a class="text-azure" id="editRowBtn{{p.ActivityID}}" ng-click="setEditId(p);"><b class="fa fa-hover fa-pencil " aria-hidden="true"></b>
|
||||
</a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr ng-show="editId === p.ActivityID" ng-if="editId === p.ActivityID" >
|
||||
<td colspan="12" ng-include src="'assets/views/editDefaultActivityStatus.html'"></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<dir-pagination-controls max-size="10" direction-links="true" boundary-links="true">
|
||||
</dir-pagination-controls>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user