This commit is contained in:
resicovenba 2017-11-23 19:25:52 +05:30
commit fd57f2e551
7 changed files with 755 additions and 165 deletions

View File

@ -0,0 +1,115 @@
<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 11/23/17
* Time: 4:11 PM
*/
class Course_Controller extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
// Configure limits on our controller methods
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
$this->methods['addCourseDetails_get']['limit'] = 500; // 500 requests per hour per user/key
$this->methods['addCourseDetails_post']['limit'] = 100; // 100 requests per hour per user/key
$this->methods['addCourseDetails_delete']['limit'] = 50; // 50 requests per hour per user/key
$this->methods['getCourseDetails_post']['limit'] = 500; // 50 requests per hour per user/key
$this->methods['updateCourseDetails_post']['limit'] = 500;
// load the model
$this->load->model('Course_model', 'course_model');
}
/*
* This method used to add Course details
* created by kms
* */
public function addCourseDetails_post()
{
$details['CourseID'] = $this->post('courseID');
$details['CourseName'] = $this->post('courseName');
$details['UniversityID'] = $this->post('universityName');
$details['CreatedBy'] = $this->post('createdBy');
$details['IsActive'] = $this->post('status');
$courseDetails = $this->course_model->addCourse($details);// Check if the users data store contains users (in case the database result returns NULL)
if ($courseDetails)
{
$courseDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($courseDetails, 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
}
}
/*
* get course details
* created by kms
* */
public function getCourseDetails_post()
{
$requestedBy = $this->post('requestedBy');
$getCourse = $this->course_model->getCourse($requestedBy);
if ($getCourse)
{
$getCourse['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($getCourse, 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 the course details
* created by kms
* */
public function updateCourseDetails_post()
{
$details['CourseID'] = $this->post('courseCode');
$details['CourseName'] = $this->post('courseName');
$details['IsActive'] = $this->post('status');
$details['UpdatedBy'] = $this->post('updatedBy');
$details['UpdatedOn'] = date("Y-m-d", time());
$updateDetails = $this->course_model->updateCourse($details);// Check if the users data store contains users (in case the database result returns NULL)
if ($updateDetails)
{
$updateDetails['status'] = REST_Controller::HTTP_OK;
// Set the response and exit
$this->response($updateDetails, 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
}
}
}

View File

@ -0,0 +1,111 @@
<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 11/23/17
* Time: 4:58 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Course_model extends CI_Model {
/*
* add course details
* created by kms
* */
public function addCourse($arrayDetails=null)
{
$this->db->select('CourseID');
$this->db->where('CourseID', $arrayDetails['CourseID']);
if($this->db->get(COURSE)->first_row()){
$result['courseStatus'] = false;
$result['message'] = "This course id is already exist!";
} else {
$this->db->insert(COURSE, $arrayDetails);
if ($this->db->affected_rows() == '1') {
$result['courseStatus'] = true;
$result['message'] = "Successfully course details added";
} else {
$result['courseStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
}
return $result;
}
/*
* get branch details
* parama id
* created by kms
* */
public function getCourse()
{
$this->db->select('CU.CourseID,CU.CourseName,CU.IsActive,US.UniversityID,US.UniversityName');
$this->db->from(COURSE.' as CU');
$this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID');
$this->db->order_by('CourseID','DESC');
$courseDetails = $this->db->get();
if($courseDetails->result()){
$result['courseStatus'] = true;
$result['details'] = $courseDetails->result();
}
else {
$result['courseStatus'] = false;
$result['message'] = "No records found!";
}
$result['universityDetails'] = $this->getUniversityDetails();
return $result;
}
/*
* update course details
* created by kms
* */
public function updateCourse($arrayDetails=null)
{
$this->db->where('CourseID',$arrayDetails['CourseID']);
$upateStatus=$this->db->update(COURSE, $arrayDetails);
if($upateStatus){
$result['courseStatus'] = true;
$result['message'] = "Successfully course details updated";
}
else {
$result['courseStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
/*
* get university details
* created by kms
* */
public function getUniversityDetails()
{
$this->db->select('UniversityID,UniversityName');
$this->db->order_by('UniversityID','ASC');
$this->db->order_by('IsActive','1');
$universityDetails = $this->db->get(UNIVERSITY);
return $universityDetails->result();
}
}

View File

@ -0,0 +1,202 @@
'use strict';
/**
* controllers for ng-table
* Simple table with sorting and filtering on AngularJS
*/
app.controller('courseCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableParams", "API_POINTS", "$localStorage", "$http", "$state", function ($scope,$rootScope,toaster, $filter, ngTableParams, apiPoint, $localStorage, $http, $state) {
$scope.myModel = {
"courseCode": "",
"courseName": "",
"universityName":"",
"switchsetting": true
};
/*
* edit branch details
* created by kms
* */
$scope.editId = -1;
$scope.setEditId = function (pid) {
$scope.editId = pid;
$scope.viewId = -1;
};
/*
* cancel edit div
* created by kms
* */
$scope.cancel = function () {
$scope.init();
$scope.editId = -1;
};
// 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
}
/*
* Submit,update and reset course details
* @params myModel
* created by kms
* */
$scope.courseForm = {
submit: function (form, myModel,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].$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 {
$scope.ldloading1 = {};
$scope.ldloading1[loading.replace('-', '_')] = true;
var addCourse = {
method: 'POST',
url: apiPoint.url + 'addCourseDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
courseID: myModel.courseCode,
courseName: myModel.courseName,
universityName: myModel.universityName,
status: myModel.switchsetting,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(addCourse).then(function (response) {
if (response.data.status==200 && response.data.courseStatus) {
$scope.ldloading1[loading.replace('-', '_')] = false;
swal("Success!", response.data.message, "success");
$state.go($state.current, {}, {reload: true});
} else {
$scope.ldloading1[loading.replace('-', '_')] = false;
swal("Failed!", response.data.message, "error");
}
});
}
},
reset: function (form) {
$scope.myModel = angular.copy($scope.master);
form.$setPristine(true);
}
};
/*
* update the course details
* created by kms
* */
$scope.updateCourse = function (myModel, 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.ldloading = {};
$scope.ldloading[loading.replace('-', '_')] = true;
var update = {
method: 'POST',
url: apiPoint.url + 'updateCourseDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
courseCode: myModel.CourseID,
courseName: myModel.CourseName,
status: myModel.IsActive,
createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(update).then(function (response) {
if (response.data.status==200 && response.data.courseStatus) {
$scope.ldloading[loading.replace('-', '_')] = false;
swal("Success!", response.data.message, "success");
$scope.editId = -1;
$scope.init();
} else {
$scope.ldloading[loading.replace('-', '_')] = false;
swal("Failed!", response.data.message, "error");
}
});
}
};
/*
*get course details when page loading called from view file
*
* created by kms
* */
$scope.loader='';
$scope.emptyData='';
$rootScope.init = function () {
var getBranch = {
method: 'POST',
url: apiPoint.url + 'getCourseDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID
}
};
$http(getBranch).then(function (response) {
if (response.data.status==200 && response.data.courseStatus) {
$scope.emptyData=true;
$scope.loader=true;
$scope.data = response.data.details;
$scope.university=response.data.universityDetails;
} else {
$scope.emptyData=false;
$scope.loader=false;
$scope.university=response.data.universityDetails;
}
});
};
}]);

View File

@ -85,7 +85,7 @@
</tbody>
</table>-->
<fieldset>
<table class="table table-hover">
<thead>
<tr>
@ -137,6 +137,7 @@
</tbody>
</table>
</fieldset>
<dir-pagination-controls max-size="5" direction-links="true" boundary-links="true">
</dir-pagination-controls>
</div>
@ -185,9 +186,9 @@
tabindex="1" class="form-control" name="branchcode"
ng-model="myModel.branchCode" ng-pattern="/^[a-zA-Z0-9.\s]*$/" required/>
<span class="error text-small block"
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.required">Branch Code required</span>
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.required">Branch code is required</span>
<span class="error text-small block"
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.pattern">Invalid Branch Code </span>
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.pattern">Invalid branch code </span>
<!--<span class="success text-small"-->
<!--ng-if="Form.stopname.$valid">Thank You!</span>-->
</div>
@ -203,9 +204,9 @@
tabindex="2" class="form-control" name="branchname"
ng-model="myModel.branchName" ng-pattern="/^[a-zA-Z0-9.\s]*$/" required/>
<span class="error text-small block"
ng-if="Form.branchname.$dirty && Form.branchname.$error.required">Branch Name required</span>
ng-if="Form.branchname.$dirty && Form.branchname.$error.required">Branch name is required</span>
<span class="error text-small block"
ng-if="Form.branchname.$dirty && Form.branchname.$error.pattern">Invalid Branch Name </span>
ng-if="Form.branchname.$dirty && Form.branchname.$error.pattern">Invalid branch name </span>
<!--<span class="success text-small"-->
<!--ng-if="Form.stopname.$valid">Thank You!</span>-->
</div>
@ -246,9 +247,9 @@
ng-pattern="/^[0-9]*$/" required>
<span class="error text-small block"
ng-if="Form.primaryPhone.$dirty && Form.primaryPhone.$invalid"
ng-hide="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Primary phone is required.</span>
ng-hide="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Phone number is required.</span>
<span class="error text-small block"
ng-if="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Enter a Valid Phone Number</span>
ng-if="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Enter a valid phone number</span>
<!-- <span class="success text-small"
ng-if="Form.primaryPhone.$valid">Thank You!</span>-->
</div>
@ -265,7 +266,7 @@
ng-minlength="10" ng-maxlength="12"
ng-pattern="/^[0-9]*$/"/>
<span class="error text-small block"
ng-if="Form.secondaryPhone.$error.maxlength || Form.secondaryPhone.$error.minlength || Form.secondaryPhone.$error.pattern">Enter a Valid Phone Number</span>
ng-if="Form.secondaryPhone.$error.maxlength || Form.secondaryPhone.$error.minlength || Form.secondaryPhone.$error.pattern">Enter a valid phone number</span>
</div>
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.Landline.$dirty && Form.Landline.$invalid, 'has-success':Form.Landline.$valid}">
@ -279,7 +280,7 @@
ng-minlength="11" ng-maxlength="13"
ng-pattern="/^[0-9-]*$/"/>
<span class="error text-small block"
ng-if="Form.Landline.$error.maxlength || Form.Landline.$error.minlength || Form.Landline.$error.pattern">Enter a Valid Number</span>
ng-if="Form.Landline.$error.maxlength || Form.Landline.$error.minlength || Form.Landline.$error.pattern">Enter a valid number</span>
</div>
</div>
<div class="row">

View File

@ -52,51 +52,35 @@
<table class="table table-hover">
<thead>
<tr>
<th ng-click="sort('BranchCode')">Course ID
<span class="glyphicon sort-icon" ng-show="sortKey=='BranchCode'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
<th ng-click="sort('CourseID')">Course ID
<span class="glyphicon sort-icon" ng-show="sortKey=='CourseID'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
<th ng-click="sort('BranchName')">Course Name
<span class="glyphicon sort-icon" ng-show="sortKey=='BranchName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
<th ng-click="sort('CourseName')">Course Name
<span class="glyphicon sort-icon" ng-show="sortKey=='CourseName'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
<th ng-click="sort('Address')">University
<span class="glyphicon sort-icon" ng-show="sortKey=='Address'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
<th ng-click="sort('UniversityName')">University
<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>
</th>
<th ng-click="sort('MobileNumber')">Mobile Number
<span class="glyphicon sort-icon" ng-show="sortKey=='MobileNumber'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
<th ng-click="sort('AlternateNumber')">Alternate Mobile
<span class="glyphicon sort-icon" ng-show="sortKey=='AlternateNumber'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
<th ng-click="sort('LandlineNumber')">Landline Number
<span class="glyphicon sort-icon" ng-show="sortKey=='LandlineNumber'" ng-class="{'glyphicon-chevron-up':reverse,'glyphicon-chevron-down':!reverse}"></span>
</th>
<th>
</th>-->
<th></th>
</tr>
</thead>
<tbody dir-paginate="p in data|orderBy:sortKey:reverse|filter:search:strict|itemsPerPage:5">
<tr>
<td>{{p.BranchCode}}</td>
<td>{{p.BranchName}}</td>
<td>{{p.Address}}</td>
<!-- <td>{{p.EmailID}}</td>
<td>{{p.MobileNumber}}</td>
<td>{{p.AlternateNumber}}</td>
<td>{{p.LandlineNumber}}</td>
<td>
<div class="pull-right margin-right-10">
<input type=button class="btn btn-info btn-sm"
id="editRowBtn{{p.BranchCode}}" value="Modify"
ng-click="setEditId(p.BranchCode);">
</div></td>-->
<td>{{p.CourseID}}</td>
<td>{{p.CourseName}}</td>
<td>{{p.UniversityName}}</td>
<td>
<input type=button class="btn btn-info btn-sm"
id="editRowBtn{{p.CourseID}}" value="Modify"
ng-click="setEditId(p.CourseID);">
</td>
</tr>
<tr ng-show="editId === p.BranchCode" ng-if="editId === p.BranchCode" style="width: ">
<tr ng-show="editId === p.CourseID" ng-if="editId === p.CourseID" style="width: ">
<td colspan="6" ng-include
src="'assets/views/editBranchDetails.html'"></td>
src="'assets/views/editCourseDetails.html'"></td>
</tr>
</tbody>
@ -125,139 +109,66 @@
<tab heading="Add Course" id="addcourse">
<div>
<form name="Form" id="form" novalidate ng-submit="branchForm.submit(Form, myModel, 'zoom-in')" method="post">
<form name="Form" id="form" novalidate ng-submit="courseForm.submit(Form, myModel, 'zoom-in')" method="post">
<div class="row">
<div class="col-md-12">
<fieldset>
<legend>
Add New Branch Details
Add New Course Details
</legend>
<div class="row">
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.branchcode.$dirty && Form.branchcode.$invalid, 'has-success':Form.branchcode.$valid}">
<div class="col-md-3 form-group"
ng-class="{'has-error':Form.coursecode.$dirty && Form.coursecode.$invalid, 'has-success':Form.coursecode.$valid}">
<label>
Branch Code <span class="symbol required"></span>
Course ID <span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Branch Code"
tabindex="1" class="form-control" name="branchcode"
ng-model="myModel.branchCode" ng-pattern="/^[a-zA-Z0-9.\s]*$/" required/>
<input type="text" placeholder="Enter Course ID"
tabindex="1" class="form-control" name="coursecode"
ng-model="myModel.courseCode" ng-pattern="/^[a-zA-Z0-9\s]*$/" required/>
<span class="error text-small block"
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.required">Branch Code required</span>
ng-if="Form.coursecode.$dirty && Form.coursecode.$error.required">Course id is required</span>
<span class="error text-small block"
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.pattern">Invalid Branch Code </span>
ng-if="Form.coursecode.$dirty && Form.coursecode.$error.pattern">Invalid course id </span>
</div>
<div class="col-md-3 form-group"
ng-class="{'has-error':Form.coursename.$dirty && Form.coursename.$invalid, 'has-success':Form.coursename.$valid}">
<label>
Course Name <span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Course Name"
tabindex="2" class="form-control" name="coursename"
ng-model="myModel.courseName" ng-pattern="/^[a-zA-Z-./\s]*$/" required/>
<span class="error text-small block"
ng-if="Form.coursename.$dirty && Form.coursename.$error.required">Course name is required</span>
<span class="error text-small block"
ng-if="Form.coursename.$dirty && Form.coursename.$error.pattern">Invalid course name </span>
<!--<span class="success text-small"-->
<!--ng-if="Form.stopname.$valid">Thank You!</span>-->
</div>
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.branchname.$dirty && Form.branchname.$invalid, 'has-success':Form.branchname.$valid}">
<div class="col-md-3 form-group"
ng-class="{'has-error':Form.university.$dirty && Form.university.$invalid, 'has-success':Form.university.$valid}">
<label>
Branch Name <span class="symbol required"></span>
University <span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Branch Name"
tabindex="2" class="form-control" name="branchname"
ng-model="myModel.branchName" ng-pattern="/^[a-zA-Z0-9.\s]*$/" required/>
<select class="form-control" name="university" tabindex="3" id="university"
ng-model="myModel.universityName"
ng-options="details.UniversityID as details.UniversityName for details in university"
required>
<option value=""> Select University</option>
</select>
<span class="error text-small block"
ng-if="Form.branchname.$dirty && Form.branchname.$error.required">Branch Name required</span>
<span class="error text-small block"
ng-if="Form.branchname.$dirty && Form.branchname.$error.pattern">Invalid Branch Name </span>
<!--<span class="success text-small"-->
<!--ng-if="Form.stopname.$valid">Thank You!</span>-->
ng-if="Form.university.$dirty && Form.university.$invalid">University is required</span>
<!--<span class="success text-small" ng-if="Form.university.$valid">Thank You!</span>-->
</div>
<div class=" col-md-4 form-group"
ng-class="{'has-error':Form.Email.$dirty && Form.Email.$invalid, 'has-success':Form.Email.$valid}">
<label>
Email ID <span class="symbol required"></span>
</label>
<input type="email" tabindex="3"
placeholder="Enter Email ID"
class="form-control"
name="Email"
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="myModel.email" required>
<span class="error text-small block"
ng-if="Form.Email.$dirty && Form.primaryEmail.$invalid"
ng-hide="Form.Email.$error.email">Email is required.</span>
<span class="error text-small block"
ng-if="Form.Email.$error.email">Please, enter a valid email address.</span>
<!--<span style="color:#000" class="success text-small"
ng-if="Form.primaryEmail.$valid">It's a valid e-mail!</span>-->
</div>
</div>
<div class="row">
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.primaryPhone.$dirty && Form.primaryPhone.$invalid, 'has-success':Form.primaryPhone.$valid}">
<label>
Mobile Number <span
class="symbol required"></span>
</label>
<input type="text" name="primaryPhone" tabindex="4"
placeholder="Enter Mobile Number"
class="form-control"
ng-model="myModel.primaryPhone"
ng-minlength="10" ng-maxlength="12"
ng-pattern="/^[0-9]*$/" required>
<span class="error text-small block"
ng-if="Form.primaryPhone.$dirty && Form.primaryPhone.$invalid"
ng-hide="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Primary phone is required.</span>
<span class="error text-small block"
ng-if="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Enter a Valid Phone Number</span>
<!-- <span class="success text-small"
ng-if="Form.primaryPhone.$valid">Thank You!</span>-->
</div>
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.secondaryPhone.$dirty && Form.secondaryPhone.$invalid, 'has-success':Form.secondaryPhone.$valid}">
<label class="control-label">
Alternate Mobile Number
</label>
<input type="text" name="secondaryPhone" tabindex="5"
placeholder="Enter Alternate Mobile Number"
class="form-control"
ng-model="myModel.secondaryPhone"
ng-minlength="10" ng-maxlength="12"
ng-pattern="/^[0-9]*$/"/>
<span class="error text-small block"
ng-if="Form.secondaryPhone.$error.maxlength || Form.secondaryPhone.$error.minlength || Form.secondaryPhone.$error.pattern">Enter a Valid Phone Number</span>
</div>
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.Landline.$dirty && Form.Landline.$invalid, 'has-success':Form.Landline.$valid}">
<label class="control-label">
Landline Number
</label>
<input type="text" name="Landline" tabindex="6"
placeholder="Enter Landline Number"
class="form-control"
ng-model="myModel.landLine"
ng-minlength="11" ng-maxlength="13"
ng-pattern="/^[0-9-]*$/"/>
<span class="error text-small block"
ng-if="Form.Landline.$error.maxlength || Form.Landline.$error.minlength || Form.Landline.$error.pattern">Enter a Valid Number</span>
</div>
</div>
<div class="row">
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.address.$dirty && Form.address.$invalid, 'has-success':Form.address.$valid}">
<label>
Address<span class="symbol required"></span>
</label>
<textarea placeholder="Enter Address" tabindex="7"
class="form-control textdsc" name="address"
ng-model="myModel.address" required></textarea>
<span class="error text-small block"
ng-if="Form.address.$dirty && Form.address.$invalid">Address is required</span>
<!--<span class="success text-small"-->
<!--ng-if="Form.address.$valid">Thank You!</span>-->
</div>
<div class="col-md-4">
<div class="col-md-3">
<label>
Active/De-Active
</label>
@ -279,7 +190,6 @@
</div>
</div>
</div>

View File

@ -19,9 +19,9 @@
tabindex="1" class="form-control" name="branchcode"
ng-model="p.BranchCode" ng-pattern="/^[a-zA-Z0-9.\s]*$/" readonly required/>
<span class="error text-small block"
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.required">Branch Code required</span>
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.required">Branch code is required</span>
<span class="error text-small block"
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.pattern">Invalid Branch Code </span>
ng-if="Form.branchcode.$dirty && Form.branchcode.$error.pattern">Invalid branch code </span>
<!--<span class="success text-small"-->
<!--ng-if="Form.stopname.$valid">Thank You!</span>-->
</div>
@ -37,9 +37,9 @@
tabindex="2" class="form-control" name="branchname"
ng-model="p.BranchName" ng-pattern="/^[a-zA-Z0-9.\s]*$/" required/>
<span class="error text-small block"
ng-if="Form.branchname.$dirty && Form.branchname.$error.required">Branch Name required</span>
ng-if="Form.branchname.$dirty && Form.branchname.$error.required">Branch name is required</span>
<span class="error text-small block"
ng-if="Form.branchname.$dirty && Form.branchname.$error.pattern">Invalid Branch Name </span>
ng-if="Form.branchname.$dirty && Form.branchname.$error.pattern">Invalid branch name </span>
<!--<span class="success text-small"-->
<!--ng-if="Form.stopname.$valid">Thank You!</span>-->
</div>
@ -80,9 +80,9 @@
ng-pattern="/^[0-9]*$/" required>
<span class="error text-small block"
ng-if="Form.primaryPhone.$dirty && Form.primaryPhone.$invalid"
ng-hide="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Primary phone is required.</span>
ng-hide="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Phone number is required.</span>
<span class="error text-small block"
ng-if="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Enter a Valid Phone Number</span>
ng-if="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Enter a valid phone number</span>
<!-- <span class="success text-small"
ng-if="Form.primaryPhone.$valid">Thank You!</span>-->
</div>
@ -99,7 +99,7 @@
ng-minlength="10" ng-maxlength="12"
ng-pattern="/^[0-9]*$/"/>
<span class="error text-small block"
ng-if="Form.secondaryPhone.$error.maxlength || Form.secondaryPhone.$error.minlength || Form.secondaryPhone.$error.pattern">Enter a Valid Phone Number</span>
ng-if="Form.secondaryPhone.$error.maxlength || Form.secondaryPhone.$error.minlength || Form.secondaryPhone.$error.pattern">Enter a valid phone number</span>
</div>
<div class="col-md-4 form-group"
ng-class="{'has-error':Form.Landline.$dirty && Form.Landline.$invalid, 'has-success':Form.Landline.$valid}">
@ -113,7 +113,7 @@
ng-minlength="11" ng-maxlength="13"
ng-pattern="/^[0-9-]*$/"/>
<span class="error text-small block"
ng-if="Form.Landline.$error.maxlength || Form.Landline.$error.minlength || Form.Landline.$error.pattern">Enter a Valid Number</span>
ng-if="Form.Landline.$error.maxlength || Form.Landline.$error.minlength || Form.Landline.$error.pattern">Enter a valid number</span>
</div>
</div>
<div class="row">

View File

@ -0,0 +1,251 @@
<form name="Form" id="form" novalidate>
<div class="row">
<div class="col-md-12">
<fieldset>
<legend>
Update Course Details
</legend>
<div class="row">
<div class="col-md-3 form-group"
ng-class="{'has-error':Form.coursecode.$dirty && Form.coursecode.$invalid, 'has-success':Form.coursecode.$valid}">
<label>
Course ID <span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Course ID"
tabindex="1" class="form-control" name="coursecode"
ng-model="p.CourseID" ng-pattern="/^[a-zA-Z0-9\s]*$/" readonly required/>
<span class="error text-small block"
ng-if="Form.coursecode.$dirty && Form.coursecode.$error.required">Course id is required</span>
<span class="error text-small block"
ng-if="Form.coursecode.$dirty && Form.coursecode.$error.pattern">Invalid course id </span>
</div>
<div class="col-md-3 form-group"
ng-class="{'has-error':Form.coursename.$dirty && Form.coursename.$invalid, 'has-success':Form.coursename.$valid}">
<label>
Course Name <span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Course Name"
tabindex="2" class="form-control" name="coursename"
ng-model="p.CourseName" ng-pattern="/^[a-zA-Z-./\s]*$/" required/>
<span class="error text-small block"
ng-if="Form.coursename.$dirty && Form.coursename.$error.required">Course name is required</span>
<span class="error text-small block"
ng-if="Form.coursename.$dirty && Form.coursename.$error.pattern">Invalid course name </span>
<!--<span class="success text-small"-->
<!--ng-if="Form.stopname.$valid">Thank You!</span>-->
</div>
<div class="col-md-3 form-group"
ng-class="{'has-error':Form.university.$dirty && Form.university.$invalid, 'has-success':Form.university.$valid}">
<label>
University <span class="symbol required"></span>
</label>
<select class="form-control" name="university" tabindex="3" id="university"
ng-model="p.UniversityID"
ng-options="details.UniversityID as details.UniversityName for details in university"
disabled required>
<option value=""> Select University</option>
</select>
<span class="error text-small block"
ng-if="Form.university.$dirty && Form.university.$invalid">University is required</span>
<!--<span class="success text-small" ng-if="Form.university.$valid">Thank You!</span>-->
</div>
<div class="col-md-3">
<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 class="col-md-12">
<div class="pull-right">
<button type="submit" ladda="ldloading.zoom_in" tabindex="9" class="btn btn-wide btn-success" data-style="zoom-in" ng-click="updateCourse(p,Form,'zoom-in')">
Save
</button>
<!-- <button type="submit" class="btn btn-success btn-o" tabindex="8">
Submit
</button>-->
<input type="button" class="btn btn-warning btn-wide" tabindex="10" value="Cancel"
ng-click="cancel();">
</input>
</div>
</div>
</fieldset>
</div>
</div>
<!-- <fieldset>
<table class="table">
<tr>
<td>
<div class="form-group"
ng-class="{'has-error':Form.branchname.$dirty && Form.branchname.$invalid, 'has-success':Form.branchname.$valid}">
<label>
Branch Name <span class="symbol required"></span>
</label>
<input type="text" placeholder="Enter Branch Name"
tabindex="5" class="form-control" name="branchname"
ng-model="p.BranchName" ng-pattern="/^[a-zA-Z0-9.\s]*$/" required/>
<span class="error text-small block"
ng-if="Form.branchname.$dirty && Form.branchname.$error.required">Branch Name required</span>
<span class="error text-small block"
ng-if="Form.branchname.$dirty && Form.branchname.$error.pattern">Invalid Branch Name </span>
&lt;!&ndash;<span class="success text-small"&ndash;&gt;
&lt;!&ndash;ng-if="Form.stopname.$valid">Thank You!</span>&ndash;&gt;
</div>
</td>
<td>
<div class="form-group"
ng-class="{'has-error':Form.Email.$dirty && Form.Email.$invalid, 'has-success':Form.Email.$valid}">
<label>
Email ID <span class="symbol required"></span>
</label>
<input type="email" tabindex="27"
placeholder="Enter Email ID"
class="form-control"
name="Email"
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" required>
<span class="error text-small block"
ng-if="Form.Email.$dirty && Form.primaryEmail.$invalid"
ng-hide="Form.Email.$error.email">Email is required.</span>
<span class="error text-small block"
ng-if="Form.Email.$error.email">Please, enter a valid email address.</span>
&lt;!&ndash;<span style="color:#000" class="success text-small"
ng-if="Form.primaryEmail.$valid">It's a valid e-mail!</span>&ndash;&gt;
</div>
</td>
<td>
<div class="form-group"
ng-class="{'has-error':Form.primaryPhone.$dirty && Form.primaryPhone.$invalid, 'has-success':Form.primaryPhone.$valid}">
<label>
Mobile Number <span
class="symbol required"></span>
</label>
<input type="text" name="primaryPhone" tabindex="29"
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.primaryPhone.$dirty && Form.primaryPhone.$invalid"
ng-hide="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Primary phone is required.</span>
<span class="error text-small block"
ng-if="Form.primaryPhone.$error.maxlength || Form.primaryPhone.$error.minlength || Form.primaryPhone.$error.pattern">Enter a Valid Phone Number</span>
&lt;!&ndash; <span class="success text-small"
ng-if="Form.primaryPhone.$valid">Thank You!</span>&ndash;&gt;
</div>
</td>
</tr>
<tr>
<td>
<div class="form-group"
ng-class="{'has-error':Form.secondaryPhone.$dirty && Form.secondaryPhone.$invalid, 'has-success':Form.secondaryPhone.$valid}">
<label class="control-label">
Alternate Mobile Number
</label>
<input type="text" name="secondaryPhone" tabindex="30"
placeholder="Enter Alternate Mobile Number"
class="form-control"
ng-model="p.AlternateNumber"
ng-minlength="10" ng-maxlength="12"
ng-pattern="/^[0-9]*$/"/>
<span class="error text-small block"
ng-if="Form.secondaryPhone.$error.maxlength || Form.secondaryPhone.$error.minlength || Form.secondaryPhone.$error.pattern">Enter a Valid Phone Number</span>
</div>
</td>
<td>
<div class="form-group"
ng-class="{'has-error':Form.Landline.$dirty && Form.Landline.$invalid, 'has-success':Form.Landline.$valid}">
<label class="control-label">
Landline Number
</label>
<input type="text" name="Landline" tabindex="30"
placeholder="Enter Landline Number"
class="form-control"
ng-model="p.LandlineNumber"
ng-minlength="11" ng-maxlength="13"
ng-pattern="/^[0-9]*$/"/>
<span class="error text-small block"
ng-if="Form.Landline.$error.maxlength || Form.Landline.$error.minlength || Form.Landline.$error.pattern">Enter a Valid Number</span>
</div>
</td>
<td>
<div class="form-group"
ng-class="{'has-error':Form.address.$dirty && Form.address.$invalid, 'has-success':Form.address.$valid}">
<label>
Address<span class="symbol required"></span>
</label>
<textarea placeholder="Enter Address" tabindex="31"
class="form-control textdsc" name="address"
ng-model="p.Address" required></textarea>
<span class="error text-small block"
ng-if="Form.address.$dirty && Form.address.$invalid">Address is required</span>
&lt;!&ndash;<span class="success text-small"&ndash;&gt;
&lt;!&ndash;ng-if="Form.address.$valid">Thank You!</span>&ndash;&gt;
</div>
</td>
<td>
<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>
</td>
<tr>
<td colspan="6">
<div class="pull-right">
<button type="submit" ladda="ldloading.zoom_in" class="btn btn-success btn-sm margin-right-15" id="update" name="update" data-style="zoom-in" ng-click="updateBranch(p,Form,'zoom-in')" tabindex="9">
Save
</button>
&lt;!&ndash; <button type="submit" class="btn btn-success btn-sm margin-right-15" ng-click="cancel()" tabindex="9">
Save
</button>&ndash;&gt;
<input type="button" class="btn btn-warning btn-sm" value=" cancel" ng-click="cancel();" tabindex="10">
</div>
</td>
</tr>
</tr>
</table>
</fieldset>-->
</form>
<!-- class="editRowTd" -->