status controller updation : kdk

This commit is contained in:
dineshkumarkannan 2018-04-12 13:56:59 +05:30
parent 2c168b9fb6
commit 0f7f19fa18
6 changed files with 267 additions and 205 deletions

View File

@ -159,6 +159,8 @@ $route['getLoginAnnouncementDetails'] = 'Login_Controller/getLoginAnnouncementDe
$route['addStatusDetails'] = 'Status_Controller/addStatusDetails';
$route['getStatusDetails'] = 'Status_Controller/getStatusDetails';
$route['updateStatusDetails'] = 'Status_Controller/updateStatusDetails';
$route['getBranchListStatusUpdate'] = 'Status_Controller/getBranchListStatusUpdate';
$route['getBranchStatusList'] = 'Status_Controller/getBranchStatusList';
/*get student list for fees update*/
$route['getStudentListFees'] = 'Fees_Status_Controller/getStudentList';
/*get student fees structure for fees update*/

View File

@ -258,6 +258,9 @@ class Employee_Controller extends REST_Controller {
$req['Qualification'] = $temp['qualificaion'];
$req['BranchCode'] = $temp['homeBranch'];
$req['IsActive'] = $temp['switchsetting'];
$req['FinanceModuleAccess'] = $temp['finaceModuleAccess'];
$req['DOJ'] = $temp['dateofjoining'];
$req['JobResponsibility'] = $temp['jobResponsibility'];
// $req['DOJ'] = $data['dateofjoining'];

View File

@ -135,6 +135,46 @@ class Status_Controller extends REST_Controller {
}
public function getBranchListStatusUpdate_post() {
$requestedBy = $this->post('requestedBy');
$getStatusBranchList = $this->status_model->getStatusBranchList($requestedBy);
if ($getStatusBranchList)
{
$getStatusBranchList['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getStatusBranchList, 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
}
}
public function getBranchStatusList_post() {
$requestedBy = $this->post('requestedBy');
$branchCode = $this->post('branchCode');
$getBranchStatusList = $this->status_model->getBranchStatusList($branchCode);
if ($getBranchStatusList)
{
$getBranchStatusList['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getBranchStatusList, 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
}
}
}

View File

@ -78,8 +78,7 @@ class Status_model extends CI_Model {
public function update($arrayDetails=null,$ListCode=null)
{
$this->db->select('ListName');
$this->db->select('ListName');
$this->db->where('ListName', $arrayDetails['ListName']);
$this->db->where_not_in('ListCode', $ListCode);
if($this->db->get(PICK_LIST_DETAILS)->first_row()){
@ -96,13 +95,27 @@ class Status_model extends CI_Model {
$result['Status'] = false;
$result['message'] = "Something went wrong.please try again";
}
}
return $result;
}
public function getStatusBranchList( $id ) {
$this->db->select('BranchCode, BranchName');
$this->db->from(BRANCH);
$getBranchDetails = $this->db->get();
$branchDetails = $getBranchDetails->result();
if (count($branchDetails) > 0) {
$results['branchListStatus'] = true;
$results['branch_list_details'] = $branchDetails;
} else {
$results['branchListStatus'] = false;
$results['message'] = "Branch Is Not Avail.";
}
return $results;
}
public function getBranchStatusList($branchCode) {
echo $branchCode;exit();
}
}

View File

@ -4,17 +4,21 @@
* Simple table with sorting and filtering on AngularJS
*/
// var helloApp = angular.module("helloApp", []);
app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$localStorage", "$http", "$state", function ($scope, toaster, $filter, apiPoint, $localStorage, $http, $state) {
app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$localStorage", "$http", "$state", 'ipCookie', function ($scope, toaster, $filter, apiPoint, $localStorage, $http, $state, ipCookie) {
$scope.myModel = {
"StatusName": "",
"StatusName": "",
"switchsetting": true
};
/*
* edit status details
* created by Surendiran
* */
// get local client details
var localDetail = JSON.parse(localStorage.getItem('localObj'));
var localDetails = ipCookie('cookiechk');
/*
* edit status details
* created by Surendiran
* */
$scope.editId = -1;
$scope.setEditId = function (pid) {
$scope.editId = pid;
@ -27,21 +31,19 @@ app.controller("statusCtrl", ["$scope", "toaster", "$filter", "API_POINTS", "$lo
* */
$scope.cancel = function () {
$scope.init();
$scope.editId = -1;
$scope.editId = -1;
};
// sorting function for table params
$scope.sort = function(keyname){
$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.statusForm = {
submit: function (form, myModel,loading) {
$scope.statusForm = {
submit: function (form, myModel, loading) {
var firstError = null;
if (form.$invalid) {
var field = null, firstError = null;
@ -63,59 +65,55 @@ $scope.statusForm = {
$scope.ldloading1[loading.replace('-', '_')] = true;
var addstatus = {
method: 'POST',
url: apiPoint.url + 'addStatusDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
statusName: myModel.StatusName,
status: myModel.switchsetting,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(addstatus).then(function (response) {
if (response.data.status == 200 && response.data.Status) {
$scope.ldloading1[loading.replace('-', '_')] = false;
$scope.init();
swal(" ", "Status added successfully.", "success");
$state.go($state.current, {}, { reload: true });
} else {
$scope.ldloading1[loading.replace('-', '_')] = false;
swal("", "Something went wrong, please try again.", "error");
}
});
}
var addstatus = {
method: 'POST',
url: apiPoint.url + 'addStatusDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
statusName: myModel.StatusName,
status: myModel.switchsetting,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(addstatus).then(function (response) {
if (response.data.status == 200 && response.data.Status) {
$scope.ldloading1[loading.replace('-', '_')] = false;
$scope.init();
swal(" ", "Status added successfully.", "success");
$state.go($state.current, {}, { reload: true });
} else {
$scope.ldloading1[loading.replace('-', '_')] = false;
swal("", "Something went wrong, please try again.", "error");
}
});
}
},
reset: function (form) {
reset: function (form) {
$scope.myModel = angular.copy($scope.master);
form.$setPristine(true);
$scope.myModel = {
"StatusName": "",
"StatusName": "",
"switchsetting": true
};
}
};
/*
*get status details when page loading called from view file
*
*
* created by Surendiran
* */
$scope.loader='';
$scope.emptyData='';
};
/*
*get status details when page loading called from view file
*
*
* created by Surendiran
* */
$scope.loader = '';
$scope.emptyData = '';
$scope.init = function () {
var getStatus = {
@ -128,28 +126,48 @@ $scope.statusForm = {
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(getStatus).then(function (response) {
if (response.data.status==200 && response.data.Status) {
$scope.emptyData=true;
$scope.loader=true;
$scope.statusInfo = response.data.details;
} else {
$scope.emptyData=false;
$scope.loader=true;
$scope.statusInfo='';
$http(getStatus).then(function (response) {
if (response.data.status == 200 && response.data.Status) {
$scope.emptyData = true;
$scope.loader = true;
$scope.statusInfo = response.data.details;
} else {
$scope.emptyData = false;
$scope.loader = true;
$scope.statusInfo = '';
}
});
var getBranchList = {
method: 'POST',
url: apiPoint.url + 'getBranchListStatusUpdate/',
headers: {
'Content-Type': 'application/json'
},
data: {
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(getBranchList).then(function (response) {
if (response.data.branchListStatus == true) {
$scope.branchList = response.data.branch_list_details;
} else {
$scope.branchListMessage = response.data.message;
}
});
};
/*
* update the status details
* created by Surendiran
* */
/*
* update the status details
* created by Surendiran
* */
$scope.updatestatus = function (myModel, form, loading) {
var firstError = null;
@ -180,28 +198,50 @@ $scope.statusForm = {
'Content-Type': 'application/json'
},
data: {
ListCode: myModel.ListCode,
ListName: myModel.ListName,
status: myModel.IsActive,
ListCode: myModel.ListCode,
ListName: myModel.ListName,
status: myModel.IsActive,
updatedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(update).then(function (response) {
if (response.data.status==200 && response.data.Status) {
if (response.data.status == 200 && response.data.Status) {
$scope.ldloading[loading.replace('-', '_')] = false;
swal("", "Updated Successfully", "success");
$scope.editId = -1;
$scope.init();
} else {
$scope.ldloading[loading.replace('-', '_')] = false;
swal("", "Something went wrong, please try again", "error");
}
});
}
};
$scope.localBranchDetails = '';
$scope.selectBranch = function(branchCode) {
// alert(branchCode);
var getBranchStatusList = {
method: 'POST',
url: apiPoint.url + 'getBranchStatusList/',
headers: {
'Content-Type': 'application/json'
},
data: {
requestedBy: localDetail,
branchCode: branchCode
}
};
$http(getBranchStatusList).then(function (response) {
if (response.data.branchListStatus == true) {
$scope.branchList = response.data.branch_list_details;
} else {
$scope.branchListMessage = response.data.message;
}
});
}
}]);

View File

@ -4,149 +4,113 @@
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="Status"></h1>
<span class="mainDescription">Manage various status for the entire application. </span>
<span class="mainDescription">Manage various status for the entire application. </span>
</div>
<div ncy-breadcrumb></div>
</div>
</section>
<div class="container-fluid container-fullw bg-white">
<div ng-controller="statusCtrl">
<form name="Form" id="form" novalidate ng-submit="statusForm.submit(Form, myModel, 'zoom-in')" method="post">
<fieldset>
<legend>Add Status Details</legend>
<div class="row">
<!--<div class="col-md-6">
<div class="padding-30">
<h2 class="StepTitle"><i
class="ti-face-smile fa-2x text-primary block margin-bottom-10"></i>
Enter Bus Stop Details</h2>
</div>
</div>-->
<div class="col-md-12">
<tabset class="tabbable">
<tab heading="Add Status" id="statuAddNew">
<form name="Form" id="form" novalidate ng-submit="statusForm.submit(Form, myModel, 'zoom-in')" method="post">
<fieldset>
<legend>Add Status Details</legend>
<div class="row">
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.StatusName.$dirty && Form.StatusName.$invalid, 'has-success':Form.StatusName.$valid}">
<label>
<div class="col-md-12">
<div class="row">
<div class="col-md-4 form-group" ng-class="{'has-error':Form.StatusName.$dirty && Form.StatusName.$invalid, 'has-success':Form.StatusName.$valid}">
<label>
Status Name <span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Status Name"
tabindex="1" class="form-control" name="StatusName"
ng-model="myModel.StatusName" ng-pattern="/^[a-zA-Z0-9.\s]*$/" capitalize required/>
<span class="error text-small block"
ng-if="Form.StatusName.$dirty && Form.StatusName.$error.required">Status name is required</span>
<span class="error text-small block"
ng-if="Form.StatusName.$dirty && Form.StatusName.$error.pattern">Invalid Status name </span>
<!--<span class="success text-small"-->
<!--ng-if="Form.stopname.$valid">Thank You!</span>-->
</div>
<!--<div class="col-md-4">
<label>
Active/De-Active
</label>
<div ng-switch="myModel.switchsetting">
<div ng-switch-when="true">
<switch ng-model="myModel.switchsetting" ng-init="myModel.switchsetting = true" class="green"></switch>
<input type="text" placeholder="Enter Status Name" tabindex="1" class="form-control" name="StatusName" ng-model="myModel.StatusName"
ng-pattern="/^[a-zA-Z0-9.\s]*$/" capitalize required/>
<span class="error text-small block" ng-if="Form.StatusName.$dirty && Form.StatusName.$error.required">Status name is required</span>
<span class="error text-small block" ng-if="Form.StatusName.$dirty && Form.StatusName.$error.pattern">Invalid Status name </span>
</div>
<div ng-switch-when="false">
<switch ng-model="myModel.switchsetting" ng-init="myModel.switchsetting = false" class="green"></switch>
</div>
<div ng-switch-default>
<switch ng-model="myModel.switchsetting" ng-init="myModel.switchsetting = true" class="green"></switch>
</div>
</div>
</div>-->
<div class="col-md-2" style="padding-top: 2.3%;">
<div class="pull-right">
<button type="submit" ladda="ldloading1.zoom_in" tabindex="2" class="btn btn-wide btn-success" data-style="zoom-in">
<div class="col-md-2" style="padding-top: 2.3%;">
<div class="pull-right">
<button type="submit" ladda="ldloading1.zoom_in" tabindex="2" class="btn btn-wide btn-success" data-style="zoom-in">
Add
</button>
<!-- <button type="submit" class="btn btn-success btn-o" tabindex="8">
Submit
</button>-->
<!--<button type="reset" class="btn btn-warning btn-wide" tabindex="3"
ng-click="statusForm.reset(Form)">
Reset
</button>-->
</div>
</div>
</div>
</div>
</div>
</fieldset>
</form>
<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>
</fieldset>
</form>
<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('ListCode')">Status ID
<span class="glyphicon sort-icon" ng-show="sortKey=='ListCode'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"> </span>
</th>
<th ng-click="sort('ListName')">Status Name
<span class="glyphicon sort-icon" ng-show="sortKey=='ListName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"> </span>
</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody dir-paginate="p in statusInfo|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:10">
<tr>
<td>{{p.ListCode}}</td>
<td>{{p.ListName}}</td>
<td><span ng-if="p.IsActive == 1"> Active </span><span ng-if="p.IsActive == 0">In-Active</span></td>
<td>
<a class="text-azure" id="editRowBtn{{p.ListCode}}" ng-click="setEditId(p.ListCode);"><b class="fa fa-hover fa-pencil " aria-hidden="true"></b>
<table class="table table-hover" ng-init="init();">
<thead>
<tr>
<th ng-click="sort('ListCode')">Status ID
<span class="glyphicon sort-icon" ng-show="sortKey=='ListCode'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"> </span>
</th>
<th ng-click="sort('ListName')">Status Name
<span class="glyphicon sort-icon" ng-show="sortKey=='ListName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"> </span>
</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody dir-paginate="p in statusInfo|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:10">
<tr>
<td>{{p.ListCode}}</td>
<td>{{p.ListName}}</td>
<td><span ng-if="p.IsActive == 1"> Active </span><span ng-if="p.IsActive == 0">In-Active</span></td>
<td>
<a class="text-azure" id="editRowBtn{{p.ListCode}}" ng-click="setEditId(p.ListCode);"><b class="fa fa-hover fa-pencil " aria-hidden="true"></b>
</a>
</td>
</tr>
<tr ng-show="editId === p.ListCode" ng-if="editId === p.ListCode">
<td colspan="12" ng-include src="'assets/views/editStatusDetails.html'"></td>
</tr>
</tbody>
</table>
<dir-pagination-controls max-size="10" direction-links="true" boundary-links="true">
</dir-pagination-controls>
</tab>
<tab heading="Status Branch Access" id="statusViewBranchRelation">
<pre>{{ branchList }}</pre>
<div class="row">
<div class="col-lg-4"></div>
<div class="col-lg-4">
<div>
<label for="form-field-select-2">
Select Branch
</label>
</td>
</tr>
<tr ng-show="editId === p.ListCode" ng-if="editId === p.ListCode">
<td colspan="12" ng-include src="'assets/views/editStatusDetails.html'"></td>
</tr>
</tbody>
</table>
<dir-pagination-controls max-size="10" direction-links="true" boundary-links="true">
</dir-pagination-controls>
<select class="form-control" tabindex="0" class="cs-select cs-skin-elastic" name="branch" ng-model="localBranchDetails"
ng-change="selectBranch(localBranchDetails)" id="selectBranch" required>
<option value="" disabled selected>Select Branch</option>
<option ng-repeat="bdata in branchList" value="{{bdata.BranchCode}}">{{bdata.BranchName}}</option>
</select>
</div>
<span ng-if="loader == true" style="color: #007AFF;
font-size: 16px;">Loading...</span>
</div>
<div class="col-lg-4"></div>
</div>
</tab>
</tabset>
</div>
</div>