university pages
This commit is contained in:
parent
1d80c93d36
commit
327356d549
@ -39,8 +39,45 @@ class University_Controller extends REST_Controller {
|
||||
$loginUserId = $reqData['localUserID'];
|
||||
$loginUserBranchId = $reqData['localBranchID'];
|
||||
$loginUserType = $reqData['localType'];
|
||||
$getUniversityListDetails = $this->university_model->get_university_list();// Check if the employee exist
|
||||
if ($getUniversityListDetails)
|
||||
{
|
||||
$getUniversityListDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No list were found',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
print_r($reqData);exit();
|
||||
}
|
||||
|
||||
public function updateUniversityDetail_post() {
|
||||
|
||||
$reqData = $this->post('data');
|
||||
$loginUserId = $reqData['localUserID'];
|
||||
$loginUserBranchId = $reqData['localBranchID'];
|
||||
$loginUserType = $reqData['localType'];
|
||||
$getUniversityListDetails = $this->university_model->get_university_list();// Check if the employee exist
|
||||
if ($getUniversityListDetails)
|
||||
{
|
||||
$getUniversityListDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No list were found',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,22 @@ class University_model extends CI_Model
|
||||
* get University Details
|
||||
*/
|
||||
|
||||
// get single employee details
|
||||
// get university list
|
||||
|
||||
public function get_university_list() {
|
||||
$this->db->select('*');
|
||||
$this->db->order_by('CreatedOn', 'DESC');
|
||||
$this->db->from(UNIVERSITY);
|
||||
$univDetails = $this->db->get();
|
||||
$universityDetails = $univDetails->result();
|
||||
if (count($universityDetails) > 0) {
|
||||
$results['univList'] = true;
|
||||
$results['university_details'] = $universityDetails;
|
||||
} else {
|
||||
$results['univList'] = false;
|
||||
$results['message'] = 'No record found';
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,6 +19,12 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
|
||||
$scope.getUniversityList();
|
||||
}
|
||||
|
||||
// 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.getUniversityList = function () {
|
||||
$scope.loader = true;
|
||||
var empListreq = {
|
||||
@ -32,16 +38,67 @@ app.controller('universityCtrl', ["$scope", "toaster", "$filter", "ngTableParams
|
||||
}
|
||||
};
|
||||
$http(empListreq).then(function (response) {
|
||||
// if (response.data.employeeList) {
|
||||
// $scope.loader = false;
|
||||
// $scope.emptyData = true;
|
||||
// $scope.data = response.data.employees_details;
|
||||
// } else {
|
||||
// $scope.loader = false;
|
||||
// $scope.emptyData = false;
|
||||
// }
|
||||
if (response.data.univList) {
|
||||
$scope.loader = false;
|
||||
$scope.emptyUniversity = true;
|
||||
$scope.data = response.data.university_details;
|
||||
} else {
|
||||
$scope.loader = false;
|
||||
$scope.emptyUniversity = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$scope.setEditId = function (id) {
|
||||
// alert(id);
|
||||
$scope.editId = id;
|
||||
}
|
||||
|
||||
$scope.cancel = function () {
|
||||
$scope.getUniversityList();
|
||||
$scope.editId = -1;
|
||||
}
|
||||
|
||||
$scope.updateUniversityDetails = function (form, p) {
|
||||
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].$name;
|
||||
}
|
||||
if (form[field].$pristine) {
|
||||
form[field].$dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
angular.element('.ng-invalid[name=' + firstError + ']').focus();
|
||||
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
|
||||
} else {
|
||||
var req = {
|
||||
method: 'POST',
|
||||
url: apiPoint.url + 'updateUniversityDetail/',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
data: p,
|
||||
updatedBy: localDetails.localUserID,
|
||||
}
|
||||
};
|
||||
$http(req).then(function (response) {
|
||||
// if (response.data.updateEmpStatus = true) {
|
||||
// swal("Success!", response.data.message, "success");
|
||||
// $scope.getEmployeeList();
|
||||
// $scope.editId = -1;
|
||||
// } else {
|
||||
// // $scope.ldloading1[loading.replace('-', '_')] = false;
|
||||
// swal("Failed!", response.data.message, "error");
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}]);
|
||||
|
||||
110
Apollo/assets/views/editUniversityDetails.html
Normal file
110
Apollo/assets/views/editUniversityDetails.html
Normal file
@ -0,0 +1,110 @@
|
||||
<form name="Form" id="form" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<fieldset>
|
||||
<legend>
|
||||
University Details
|
||||
</legend>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.universityId.$dirty && Form.universityId.$invalid, 'has-success':Form.universityId.$valid}">
|
||||
<label>
|
||||
University ID <span class="symbol required"></span>
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="University Id" tabindex="1" class="form-control" name="universityId" ng-model="p.UniversityID"
|
||||
ng-pattern="/^[a-zA-Z0-9.\s]*$/" ng-blur='checkEmpIdExist()' readonly required/>
|
||||
<span class="error text-small block" ng-if="Form.universityId.$dirty && Form.universityId.$error.required">university Id</span>
|
||||
<span class="error text-small block" ng-if="Form.universityId.$dirty && Form.universityId.$error.pattern">Invalid university Id </span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.UniversityShortName.$dirty && Form.UniversityShortName.$invalid, 'has-success':Form.UniversityShortName.$valid}">
|
||||
<label>
|
||||
University Short Name <span class="symbol required"></span>
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="University Short Name" tabindex="2" class="form-control" name="UniversityShortName" ng-model="p.UniversityShortName"
|
||||
ng-pattern="/^[a-zA-Z0-9.\s]*$/" required/>
|
||||
<span class="error text-small block" ng-if="Form.UniversityShortName.$dirty && Form.UniversityShortName.$error.required">University Short Name required</span>
|
||||
<span class="error text-small block" ng-if="Form.UniversityShortName.$dirty && Form.UniversityShortName.$error.pattern">Invalid University Short Name </span>
|
||||
</div>
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.UniversityName.$dirty && Form.UniversityName.$invalid}">
|
||||
<label>
|
||||
University Name
|
||||
</label>
|
||||
|
||||
<input type="text" placeholder="University Name" tabindex="4" class="form-control" name="UniversityName" ng-model="p.UniversityName"
|
||||
ng-pattern="/^[a-zA-Z.\s]*$/" />
|
||||
<span class="error text-small block" ng-if="Form.UniversityName.$dirty && Form.UniversityName.$error.pattern">Invalid University Name </span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.MobileNumber.$dirty && Form.MobileNumber.$invalid, 'has-success':Form.MobileNumber.$valid}">
|
||||
<label>
|
||||
Mobile Number <span
|
||||
class="symbol required"></span>
|
||||
</label>
|
||||
<input type="text" name="MobileNumber" tabindex="7" placeholder="Enter Mobile Number" class="form-control" ng-model="p.MobileNumber"
|
||||
ng-minlength="10" ng-maxlength="12" ng-pattern="/^[0-9]*$/" required/>
|
||||
<span class="error text-small block" ng-if="Form.MobileNumber.$dirty && Form.MobileNumber.$invalid" ng-hide="Form.MobileNumber.$error.maxlength || Form.MobileNumber.$error.minlength || Form.MobileNumber.$error.pattern">Mobile Number is required.</span>
|
||||
<span class="error text-small block" ng-if="Form.MobileNumber.$error.maxlength || Form.MobileNumber.$error.minlength || Form.MobileNumber.$error.pattern">Enter a Valid Phone Number</span>
|
||||
</div>
|
||||
<div class=" col-md-4 form-group" ng-class="{'has-error':Form.emailId.$dirty && Form.emailId.$invalid, 'has-success':Form.emailId.$valid}">
|
||||
<label>
|
||||
Email ID <span class="symbol required"></span>
|
||||
</label>
|
||||
<input type="email" tabindex="6" placeholder="Enter Email ID" class="form-control" name="emailId" ng-pattern="/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i"
|
||||
ng-model="p.EmailID" ng-blur='updateCheckEmailExist(p)' required>
|
||||
<span class="error text-small block" ng-if="Form.emailId.$dirty && Form.primaryEmail.$invalid" ng-hide="Form.emailId.$error.email">Email is required.</span>
|
||||
<span class="error text-small block" ng-if="Form.emailId.$error.email">Please, enter a valid email address.</span>
|
||||
</div>
|
||||
<div class="col-md-4 form-group" ng-class="{'has-error':Form.Address.$dirty && Form.Address.$invalid}">
|
||||
<label>
|
||||
Address
|
||||
</label>
|
||||
<textarea placeholder="Enter Address" tabindex="15" class="form-control textdsc" name="Address" ng-model="p.Address"></textarea>
|
||||
<span class="error text-small block" ng-if="Form.Address.$dirty && Form.Address.$invalid">Address is required</span>
|
||||
</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>
|
||||
<!--<pre>{{ p | json}}</pre>-->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-right">
|
||||
<button type="button" ladda="ldloading1.zoom_in" tabindex="19" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="updateUniversityDetails(Form, p)">
|
||||
Save
|
||||
</button>
|
||||
<button type="reset" class="btn btn-warning btn-wide" tabindex="20" ng-click="cancel()">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- class="editRowTd" -->
|
||||
@ -24,12 +24,12 @@
|
||||
</spinner>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12" ng-if="emptyData == false" style="min-height: 281px;">
|
||||
<div class="col-md-12" ng-if="emptyUniversity == false" style="min-height: 281px;">
|
||||
<p style="color: red;" align="center"><strong><h3 class="text-center">No
|
||||
records found... </h3></strong></p>
|
||||
</div>
|
||||
|
||||
<!--<div class="col-md-12" ng-if="emptyData == true">
|
||||
<div class="col-md-12" ng-if="emptyUniversity == true">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<script>
|
||||
@ -44,17 +44,14 @@
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th ng-click="sort('StaffID')">Staff Id
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='StaffID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
|
||||
<th ng-click="sort('UniversityID')">University ID
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='UniversityID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
|
||||
</th>
|
||||
<th ng-click="sort('Firstname')">First Name
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='Firstname'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
|
||||
<th ng-click="sort('UniversityShortName')">University Short Name
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='UniversityShortName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
|
||||
</th>
|
||||
<th ng-click="sort('Lastname')">Last Name
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='Lastname'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
|
||||
</th>
|
||||
<th ng-click="sort('MobileNumber')">MobileNumber
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='MobileNumber'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
|
||||
<th ng-click="sort('UniversityName')">University Name
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='UniversityName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
|
||||
</th>
|
||||
<th ng-click="sort('EmailID')">Email ID
|
||||
<span class="glyphicon sort-icon" ng-show="sortKey=='EmailID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
|
||||
@ -65,22 +62,17 @@
|
||||
</thead>
|
||||
<tbody dir-paginate="p in data|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:5">
|
||||
<tr>
|
||||
<td>{{p.StaffID}}</td>
|
||||
<td>{{p.Firstname}}</td>
|
||||
<td>{{p.Lastname}}</td>
|
||||
<td>{{p.MobileNumber}}</td>
|
||||
<td>{{p.UniversityID}}</td>
|
||||
<td>{{p.UniversityShortName}}</td>
|
||||
<td>{{p.UniversityName}}</td>
|
||||
<td>{{p.EmailID}}</td>
|
||||
<td style="text-align: center;">
|
||||
<input type=button class="btn btn-info btn-xs" ladda="ldloading1.zoom_in" id="editRowBtn{{p.StaffID}}" value="Personal Details"
|
||||
ng-click="setEditId(p.StaffID);">
|
||||
<input type=button class="btn btn-blue btn-xs" id="editBranchRowBtn{{p.StaffID}}" value="Branch Details" ng-click="setEditBranchId(p.StaffID);">
|
||||
<input type=button class="btn btn-info btn-xs" ladda="ldloading1.zoom_in" id="editRowBtn{{p.UniversityID}}" value="Modify"
|
||||
ng-click="setEditId(p.UniversityID);">
|
||||
</td>
|
||||
</tr>
|
||||
<tr ng-show="editId === p.StaffID" ng-if="editId === p.StaffID">
|
||||
<td colspan="6" ng-include src="'assets/views/editEmployeeDetails.html'"></td>
|
||||
</tr>
|
||||
<tr ng-show="editBranchId === p.StaffID" ng-if="editBranchId === p.StaffID">
|
||||
<td colspan="6" ng-include src="'assets/views/editEmployeeBranchDetails.html'"></td>
|
||||
<tr ng-show="editId === p.UniversityID" ng-if="editId === p.UniversityID">
|
||||
<td colspan="6" ng-include src="'assets/views/editUniversityDetails.html'"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@ -90,7 +82,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</tab>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user