data correction screen for student merge
This commit is contained in:
parent
6fd2101c41
commit
a65458bc77
@ -348,6 +348,9 @@ $route['report_examfee'] = 'Report/examfee';
|
||||
$route['report_balfee'] = 'Report/balfee';
|
||||
$route['report_lead'] = 'Report/lead';
|
||||
$route['insertUniversityfile'] = 'UniversityFile_Controller/insertUniversityfile';
|
||||
//Data correction
|
||||
$route['Stud_Merge'] = 'DataCorrection_Controller/StudMerge';
|
||||
$route['get_Mob'] = 'DataCorrection_Controller/getMob';
|
||||
|
||||
//Application Form Details
|
||||
$route['getApplicationFromDetails'] = 'StatusUpdation_Controller/getApplicationFromDetails';
|
||||
|
||||
@ -35,9 +35,32 @@ class DataCorrection_Controller extends REST_Controller {
|
||||
|
||||
public function StudMerge_post()
|
||||
{
|
||||
$toDelete = $this->post('toDelete');
|
||||
$toMerge = $this->post('toMerge');
|
||||
$getStatus = $this->Data_correction->Student_Merge($toDelete,$toMerge);
|
||||
$name = $this->post('name');
|
||||
$getStatus = $this->Data_Correction->Student_Merge($name);
|
||||
//print_r($getStatus);
|
||||
if ($getStatus)
|
||||
{
|
||||
$getStatus['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getStatus, 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 getMob_post()
|
||||
{
|
||||
$deleteNo = $this->post('deleteNo');
|
||||
$mergeNo = $this->post('mergeNo');
|
||||
$getStatus = $this->Data_Correction->getMobile($deleteNo,$mergeNo);
|
||||
//print_r($getStatus);
|
||||
if ($getStatus)
|
||||
{
|
||||
|
||||
@ -7,9 +7,15 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Data_Correction extends CI_Model
|
||||
{
|
||||
Public function Student_Merge($toDelete=null,$toMerge=null)
|
||||
Public function Student_Merge($name=null)
|
||||
{
|
||||
$sql = "";
|
||||
$sql = "select scd.StudentID as Student_id,scd.CourseID as cid,Firstname as Student_name,std.MobileNumber as Phone_number,CourseName as Course_name,UniversityName as University
|
||||
from T_Student_CourseDetails as scd
|
||||
left join T_StudentDetails as std on std.StudentID = scd.StudentID and std.IsActive = 1
|
||||
left join T_CourseMaster AS cm ON cm.CourseID = scd.CourseID
|
||||
left join T_UniversityMaster as univ on univ.UniversityID = scd.UniversityID
|
||||
where Firstname like '".$name."'
|
||||
group by Student_id,cid";
|
||||
$b=$this->db->query($sql);
|
||||
$batch = $b->result();
|
||||
if (count($batch) > 0) {
|
||||
@ -21,6 +27,26 @@ class Data_Correction extends CI_Model
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
Public function getMobile($deleteNo=null,$mergeNo=null)
|
||||
{
|
||||
$sql = "call SP_MERGE_STUDENT_DATA('".$deleteNo."','".$mergeNo."',@countRow);
|
||||
";
|
||||
$a=$this->db->query($sql);
|
||||
$sqlOut = " select @countRow as counts;";
|
||||
$b=$this->db->query($sqlOut);
|
||||
$batch = $b->result();
|
||||
//echo $batch[0]->counts;
|
||||
if ($batch[0]->counts > 0) {
|
||||
$results['MergeStatus'] = true;
|
||||
$results['after_Merge'] = $batch;
|
||||
$results['message'] = 'Student details successfully merged';
|
||||
} else {
|
||||
$results['MergeStatus'] = false;
|
||||
$results['message'] = 'Can not Merge';
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -157,7 +157,8 @@
|
||||
},
|
||||
"entry": {
|
||||
"MAIN": "My Details",
|
||||
"coursecorrection": "Course Details"
|
||||
"coursecorrection": "Course Details",
|
||||
"stud_merge": "Student Merge"
|
||||
},
|
||||
"announcement": {
|
||||
"MAIN": "ANNOUNCEMENT",
|
||||
|
||||
@ -236,7 +236,10 @@ app.constant('JS_REQUIRES', {
|
||||
'report_examfeeCtrl':'assets/js/controllers/report_examfeeCtrl.js',
|
||||
'report_balfeeCtrl':'assets/js/controllers/report_balfeeCtrl.js',
|
||||
'report_leadCtrl':'assets/js/controllers/report_leadCtrl.js',
|
||||
|
||||
|
||||
//Data Correction
|
||||
'studentMergeCtrl':'assets/js/controllers/studentMergeCtrl.js',
|
||||
|
||||
/**
|
||||
* univesity sutdent fee compare details
|
||||
*/
|
||||
|
||||
@ -807,6 +807,15 @@ app.config(['$stateProvider', '$urlRouterProvider', '$controllerProvider', '$com
|
||||
label: 'coursecorrection'
|
||||
},
|
||||
|
||||
}).state('app.entry.stud_merge', {
|
||||
url: '/studentMergeCtrl',
|
||||
templateUrl: "assets/views/StudentMerge.html",
|
||||
resolve: loadSequence('studentMergeCtrl','ngTable', 'ladda', 'angular-ladda'),
|
||||
title: 'Student Merge',
|
||||
ncyBreadcrumb: {
|
||||
label: 'Student Merge'
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
// $locationProvider.html5Mode(true);
|
||||
|
||||
225
Apollo/assets/js/controllers/studentMergeCtrl.js
Normal file
225
Apollo/assets/js/controllers/studentMergeCtrl.js
Normal file
@ -0,0 +1,225 @@
|
||||
'use strict';
|
||||
/*** controller***/
|
||||
app.controller('studentMergeCtrl', ["$scope", "$filter","$rootScope", "API_POINTS", "$http", "SweetAlert", "$state", 'md5', 'ipCookie', '$window',"dateListDescService","$modal",
|
||||
function ($scope, $filter,$rootScope, apiPoint, $http, SweetAlert, $state, md5, ipCookie, $window, dateListDescService,$modal,$log) {
|
||||
|
||||
$scope.name = {
|
||||
"studentName": "",
|
||||
|
||||
};
|
||||
|
||||
$scope.onSubmit = function (form) {
|
||||
var firstError = null;
|
||||
if (form.$invalid) {
|
||||
var field = null, firstError = null;
|
||||
$scope.show = true;
|
||||
for (field in form) {
|
||||
if (field[0] != '$') {
|
||||
if (firstError === null && !form[field].$valid) {
|
||||
firstError = form[field].$studentName;
|
||||
}
|
||||
if (form[field].$pristine) {
|
||||
form[field].$dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
angular.element('.ng-invalid[batch=' + firstError + ']').focus();
|
||||
}else {
|
||||
//alert($scope.batch.name);
|
||||
$scope.stud_merge = '';
|
||||
$scope.message = '';
|
||||
console.log($scope.stud_merge);
|
||||
var response_data = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'Stud_Merge/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
name: $scope.name.studentName
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$http(response_data).then(function (response) {
|
||||
if (response.data.MergeStatus == true) {
|
||||
$scope.stud_merge = response.data.Stud_Merge;
|
||||
} else {
|
||||
$scope.message = response.data.message;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//merge student
|
||||
$scope.selectedStudentsID = [];
|
||||
$scope.number1 = '';
|
||||
$scope.number2 = '';
|
||||
$scope.getMobile = '';
|
||||
$scope.toDelete = '';
|
||||
$scope.toMerge = '';
|
||||
// $rootScope.num1 = '';
|
||||
// $rootScope.num2 = '';
|
||||
$scope.isCheckAll = function(e){
|
||||
var val = (e.target.checked ? true : false);
|
||||
if(val)
|
||||
{
|
||||
// $scope.disable = false;
|
||||
var len = $scope.Stud_Merge.length;
|
||||
var i = 0;
|
||||
for(i=0;i<len;i++)
|
||||
{
|
||||
if($scope.selectedStudentsID.indexOf($scope.Stud_Merge[i]) === -1)
|
||||
{
|
||||
|
||||
$scope.selectedStudentsID.push($scope.Stud_Merge[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// $scope.disable = true;
|
||||
$scope.selectedStudentsID = [];
|
||||
}
|
||||
if($scope.selectedStudentsID !=''){
|
||||
$scope.disable = false;
|
||||
}else{
|
||||
$scope.disable = true;
|
||||
}
|
||||
console.log($scope.selectedStudentsID);
|
||||
}
|
||||
$scope.isClick = function(e){
|
||||
var ide = e.target;
|
||||
var val = (ide.checked ? true : false);
|
||||
var sid = e.target.id;
|
||||
angular.forEach($scope.Stud_Merge,function(value,key){
|
||||
//console.log(value);
|
||||
if(sid == value.Student_id)
|
||||
{
|
||||
console.log()
|
||||
sid = value;
|
||||
}
|
||||
});
|
||||
|
||||
var pos = $scope.selectedStudentsID.indexOf(sid);
|
||||
//alert(val);
|
||||
if(val)
|
||||
{
|
||||
if( pos == -1)
|
||||
{
|
||||
|
||||
console.log("PUSH");
|
||||
$scope.selectedStudentsID.push(sid);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//console.log("POP");
|
||||
$scope.selectedStudentsID.splice(pos,1);
|
||||
}
|
||||
//
|
||||
if(val){
|
||||
$scope.disable = false;
|
||||
}else{
|
||||
$scope.disable = true;
|
||||
}
|
||||
console.log($scope.selectedStudentsID);
|
||||
console.log($scope.selectedStudentsID[0]);
|
||||
console.log($scope.selectedStudentsID[1]);
|
||||
$scope.number1 = $scope.selectedStudentsID[0];
|
||||
$scope.number2 = $scope.selectedStudentsID[1];
|
||||
}
|
||||
$scope.merge = function(){
|
||||
|
||||
//$rootScope.student = $scope.selectedStudentsID;
|
||||
if($scope.selectedStudentsID ==''){
|
||||
swal('Select Check box','','warning');
|
||||
return false;
|
||||
}else{
|
||||
$scope.controller = 'ng-controller="studentMergeCtrl"';
|
||||
|
||||
|
||||
$rootScope.num1 = $scope.number1;
|
||||
$rootScope.num2 = $scope.number2;
|
||||
|
||||
$rootScope.modalInstance = $modal.open({
|
||||
templateUrl: 'assets/views/MergeStudentModal.html',
|
||||
controller: 'studentMergeCtrl',
|
||||
// size: size,
|
||||
|
||||
|
||||
});
|
||||
|
||||
$rootScope.modalInstance.result.then(function (selectedItem) {
|
||||
$scope.selected = selectedItem;
|
||||
}, function () {
|
||||
$log.info('Modal dismissed at: ' + new Date());
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$scope.merge_student = {
|
||||
submit: function (form, getMobile) {
|
||||
//alert(getMobile);
|
||||
if(getMobile=="option1"){
|
||||
console.log("if");
|
||||
$scope.toDelete = $rootScope.num1;
|
||||
$scope.toMerge = $rootScope.num2;
|
||||
console.log($scope.toDelete);
|
||||
console.log($scope.toMerge);
|
||||
}else{
|
||||
console.log("else");
|
||||
$scope.toDelete = $rootScope.num2;
|
||||
$scope.toMerge = $rootScope.num1;
|
||||
console.log($scope.toDelete);
|
||||
console.log($scope.toMerge);
|
||||
}
|
||||
|
||||
var toMerge = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'get_Mob/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
deleteNo:$scope.toDelete,
|
||||
mergeNo: $scope.toMerge,
|
||||
}
|
||||
};
|
||||
$http(toMerge).then(function (response) {
|
||||
if (response.data.status==200 && response.data.MergeStatus == true) {
|
||||
$rootScope.modalInstance.close();
|
||||
swal(" ", response.data.message, "success");
|
||||
$state.go($state.current, {}, { reload: true });
|
||||
|
||||
} else {
|
||||
|
||||
swal(" ", response.data.message, "error");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
||||
//End of merge student
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}]);
|
||||
|
||||
|
||||
|
||||
|
||||
45
Apollo/assets/views/MergeStudentModal.html
Normal file
45
Apollo/assets/views/MergeStudentModal.html
Normal file
@ -0,0 +1,45 @@
|
||||
<div class="container-fluid container-fullw bg-white" controller>
|
||||
<form name="Form" id="form" novalidate ng-submit="merge_student.submit(Form, getMobile)" method="post">
|
||||
<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">
|
||||
<fieldset>
|
||||
<legend>
|
||||
Select Mobile number to merge
|
||||
</legend>
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
|
||||
<input type="radio" class="with-gap" ng-model='getMobile' ng-value='"option1"'> {{num1}} to merge with {{num2}}
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<input type="radio" class="with-gap" ng-model='getMobile' ng-value='"option2"'> {{num2}} to merge with {{num1}}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<button tabindex="13" type="submit" ladda="ldloading1.zoom_in" class="btn btn-wide btn-success" data-style="zoom-in">
|
||||
Submit
|
||||
</button>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
109
Apollo/assets/views/StudentMerge.html
Normal file
109
Apollo/assets/views/StudentMerge.html
Normal file
@ -0,0 +1,109 @@
|
||||
<section id="page-title">
|
||||
<div class="row">
|
||||
<div class="col-sm-8">
|
||||
<h1 class="mainTitle">Student Merge</h1>
|
||||
</div>
|
||||
<!-- <div ncy-breadcrumb></div> -->
|
||||
</div>
|
||||
</section>
|
||||
<style>
|
||||
td,th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
th{
|
||||
text-align:center;
|
||||
}
|
||||
.table>tbody>tr>td { padding: 2px; }
|
||||
/* .sort-icon {
|
||||
font-size: 9px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
th {
|
||||
cursor: pointer;
|
||||
} */
|
||||
</style>
|
||||
|
||||
|
||||
</script>
|
||||
<div class="container-fluid container-fullw bg-white">
|
||||
<div ng-controller="studentMergeCtrl" ng-init="filters()">
|
||||
<form name="Form" id="form" novalidate ng-submit="onSubmit(Form)" method="post">
|
||||
<fieldset>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-3">
|
||||
<label for="form-field-select-2">
|
||||
Student Name
|
||||
</label>
|
||||
|
||||
<input type="text" tabindex="1" class="form-control " placeholder="Student Name" ng-model="name.studentName" name="studentName" required="required" />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-2" style="padding-top: 2.3%;">
|
||||
<div >
|
||||
|
||||
<button type="submit" class="btn btn-success btn-o" tabindex="8">
|
||||
Submit
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
<!-- <pre>{{statusr | json}}</pre> -->
|
||||
<div class="row" style="text-align: right;">
|
||||
|
||||
<button class="btn btn-success btn-o" ng-click="merge()">Merge</button>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="datatable" class="table table-hover" style="font-size:0.9em;">
|
||||
|
||||
|
||||
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
|
||||
<th>Student Name</th>
|
||||
<th>Mobile Number</th>
|
||||
<th>Course Name</th>
|
||||
<th>University</th>
|
||||
<th>Action</th>
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody dir-paginate="p in stud_merge|filter:search:strict|itemsPerPage:10">
|
||||
<tr>
|
||||
|
||||
<td>{{p.Student_name}}</td>
|
||||
<td>{{p.Phone_number}}</td>
|
||||
<td>{{p.Course_name}}</td>
|
||||
<td>{{p.University}}</td>
|
||||
<td style="text-align:center;"><input type="checkbox" ng-checked="myModel.all" id="{{p.Phone_number}}" name="{{p.Phone_number}}" class="form-control" ng-click="isClick($event);" style="width:17px" /></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<h3 style="text-align:center;">{{message}}</h3>
|
||||
|
||||
</div>
|
||||
|
||||
<dir-pagination-controls direction-links="true" boundary-links="true">
|
||||
</dir-pagination-controls>
|
||||
</div>
|
||||
</div>
|
||||
@ -555,6 +555,11 @@
|
||||
<span class="title" translate="sidebar.nav.entry.coursecorrection">COURSECORRECTION</span>
|
||||
</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="app.entry.stud_merge" ng-click="checkSuperAdmin()">
|
||||
<span class="title" translate="sidebar.nav.entry.stud_merge">Student Merge</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user