This commit is contained in:
telangpu
2026-05-10 22:39:11 +08:00
parent bc675f5e4d
commit 91fd7ffcf0
395 changed files with 309652 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
'use strict';
/* App Module */
(function () {
angular.module('echallan', ['ngMap','ngRateIt',
'angular-md5',
'ngStorage',
'angularFileUpload',
'ngCookies'
,'ngMaterial','ngMessages','material.svgAssetsCache'
,'angularjs-dropdown-multiselect','countTo'
])
})();

View File

@@ -0,0 +1,792 @@
'use strict';
/* App Module */
function GsticketController($scope, requestHandler, $http, authService, md5, $timeout, $cookieStore, $window) {
$scope.loginForm = {};
$scope.forgetPass = {};
$scope.success = {};
$scope.fails = {};
$scope.registerForm = {};
$scope.registerPanel = false;
$scope.otpPanel = true;
$scope.registerForm.idType = 'idType_dl';
$scope.baseUrl = defaultUrl;
//$scope.registerHashKey = '';
$scope.loader = true;
$scope.detail_form = true;
$scope.otpMsg = false;
$scope.accused = {};
$scope.isData =false;
$scope.otpAlert=false;
$scope.challan_number_new = true;
$scope.generateOtp = {};
$scope.challan_details = {};
$scope.isOtpSubmitDisable = true;
$scope.isSendOtpHidden = false;
$scope.isResendOtpHidden = true;
$scope.transaction_history = {};
$scope.transaction_history_challan_no = '';
$scope.otp = '';
$scope.formdata = '';
$scope.challanForm = '';
//$scope.gsloader = true;
//$scope.isOTPValid = false;
$scope.adharOtpVerificationCount = 1;
$scope.challanDetailForm = {};
// $scope.generateAadharOtp.aadhar_no = '';
// $scope.generateAadharOtp.mobile_no = '';
//for register id type
$scope.isShown = function (div) {
return div === $scope.registerForm.idType;
};
var pageHeight =$(window).height()-240;
$('#otpPanel').css('height',pageHeight);
$(window).resize(function() {
var pageHeight =$(window).height()-240;
$('#otpPanel').css('height',pageHeight);
});
//for index panels otp and register
$scope.showRegisterationPanel = function () {
$scope.registerPenal = true;
$scope.otpPanel = false;
};
$scope.hideTab =function(){
$scope.isData=false;
var pageHeight =$(window).height()-240;
$('#otpPanel').css('height',pageHeight);
};
//for index panels otp and register
$scope.showHide = function () {
$scope.registerPenal = !$scope.registerPenal;
$scope.otpPanel = !$scope.otpPanel;
};
// function to get the initial data for admin page
/*function getFormKey() {
requestHandler.preparePostRequest({
url: $scope.baseUrl + '/index/get-form-key'
}).then(function (data) {
$scope.registerHashKey = data.registerHashKey;
});
}*/
$scope.resetCookies = function(){
if($cookieStore.get('welcomeImage')) {
$cookieStore.remove('welcomeImage');
}
};
//------------------ Start --------------------------
$scope.verifyChallanNo = function () {
$("#gs_ticket_detail").css("display","none");
$('#validation_error').text("");
$scope.isSendAadharOtpHidden = false;
$scope.isAadharOtpSubmitDisable = true;
var isAadharChecked = $("#by_aadhar_mobile").is(":checked");
if(isAadharChecked){
$scope.reSizePopup('by_aadhaar');
}
var challan_no = $('#challan_no').val();
if(challan_no == '' || challan_no == null || challan_no.length>25)
{
$scope.invalidname = true;
swal({
icon:"error",
title:"<span style='color:red !important'>Error</span>",
html:lang.PLEASE_ENTER_CHALLAN_NUMBER,
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.CLOSE
});
if(challan_no.length>25){
swal({
icon:"error",
title:"<span style='color:red !important'>Error</span>",
html:lang.CHALLAN_NUMBER_CAN_NOT_BE_EXCEEDED_THAN_25_CHARACTERS,
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.CLOSE
});
}
$('#challan_no').css('background-color', '#FFE4E1');
$('#challan_no').addClass('form-error');
$('#challan_no').focus();
var tmr = setInterval(function(){ $('#challan_no').css('background-color', '#FFFFFF'); $('#challan_no').removeClass('form-error'); clearInterval(tmr); }, 4000);
return false;
}
$('#flashMsgContainerDiv').css("display","none");
var requestData = {'challan_no' : btoa(challan_no)};
$('#loader').css("display","block");
$("#loader-overlay").css("display","block");
$http({
url : $scope.baseUrl+'/gsticket/verify-challan',
method: 'POST',
params: {data:requestData},
headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}
}).success(function(rdata) {
if(rdata.status == 'success'){
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
$('#generateAadharOtpModal').modal('show');
$('#aadhar_no').val('');
$('#vaadhar_no').val('');
$('#mobile_no').val('');
$('#agree').prop('checked',false);
$scope.isOptionSelected = false;
//$scope.generateAadharOtp.isAgree = false;
//$scope.generateAadharOtp.otp_type = 'by_mobile_no';
}else if(rdata.status == 'alert'){
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
swal({
icon:"error",
title:"<span style='color:red !important'>Information Alert</span>",
html:rdata.message,
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.CLOSE
});
}else{
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
swal({
icon:"error",
title:"<span style='color:red !important'>Error</span>",
html:rdata.message,
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.CLOSE
});
}
});
};
function refreshCaptcha1(){
var img = document.images['captchaimg1'];
img.src = $scope.baseUrl +'/index/captcha-login'+"?rand="+Math.random()*1000;
}
$scope.showSubmitButton = function(isAgree){
if(isAgree){
$scope.isOptionSelected = true;
}else{
$scope.isOptionSelected = false;
}
}
$scope.checkRadioButtonOtpbyAadhaar = function(radio){
$scope.generateAadharOtp.aadhar_otp_type = 'by_aadhar_mobile';
$scope.aadhar_otp_type = true;
$scope.generateAadharOtp.isAgree = false;
$scope.vaadhar_otp_type = false;
$scope.generateAadharOtp.aadhar_no = '';
$scope.generateAadharOtp.vaadhar_no = '';
}
$scope.reSizePopup = function(tickedRadioButton){
if(tickedRadioButton == 'by_mobile'){
$("#generateAadharOtpModal").css("max-height","280px");
}else if(tickedRadioButton != 'by_mobile'){
$("#generateAadharOtpModal").css("max-height","550px");
}
}
$scope.sendAadhaarOtp = function () {
$("#gs_ticket_detail").css("display","none");
$("#gs_ticket_challan_row").css("display","block");
$("#validation_error").text("");
var aadharNo = $scope.generateAadharOtp.aadhar_no;
var vrtlAadharId = $scope.generateAadharOtp.vaadhar_no;
var mobileNo = $scope.generateAadharOtp.mobile_no;
var otpType = $scope.generateAadharOtp.aadhar_otp_type;
var otpMainType = $scope.generateAadharOtp.otp_type;
$('#loader').css("display","block");
$("#loader-overlay").css("display","block");
if((otpMainType!='by_mobile_no') && (otpType=='by_aadhar_mobile') && ((angular.isUndefined($scope.generateAadharOtp.aadhar_no)) || $scope.generateAadharOtp.aadhar_no == '' || !(String(aadharNo).match(/^\d{12}$/)))){
swal(
'Invalid Aadhar Number',
'Please enter valid Aadhar number.'
);
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
$scope.isAadharOtpSubmitDisable = false;
}else if((otpMainType!='by_mobile_no') && (otpType=='by_vaadhar_mobile') && ((angular.isUndefined($scope.generateAadharOtp.vaadhar_no)) || $scope.generateAadharOtp.vaadhar_no == '' || !(String(vrtlAadharId).match(/^\d{16}$/)))){
swal(
'Invalid Virtual Aadhar Id',
'Please enter valid Virtual Aadhar Id.'
);
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
$scope.isAadharOtpSubmitDisable = false;
}else if((otpMainType=='by_mobile_no') && ((angular.isUndefined($scope.generateAadharOtp.mobile_no)) || $scope.generateAadharOtp.mobile_no == '' || !(String(mobileNo).match(/^\d{10}$/)))){
swal(
'Invalid Mobile Number',
'Please enter valid Mobile number.'
);
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
$scope.isAadharOtpSubmitDisable = false;
}else {
$scope.isAadharOtpSubmitDisable = true;
$scope.alertMessage = '';
var isAgree = $scope.generateAadharOtp.isAgree;
var consent_value = 'N';
if(isAgree){
consent_value = 'Y';
}
var requestData = {'otp_type': $scope.generateAadharOtp.otp_type, 'aadhar_otp_type':$scope.generateAadharOtp.aadhar_otp_type,'aadhar_no': btoa($scope.generateAadharOtp.aadhar_no),'vaadhar_no': btoa($scope.generateAadharOtp.vaadhar_no),'mobile_no': btoa($scope.generateAadharOtp.mobile_no),'consent':btoa(consent_value)}
$http({
method: 'POST',
url: $scope.baseUrl + '/gsticket/send-otp',
transformRequest: 20,
params: {data: requestData},
headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}
}).success(function (data) {
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
if(data.status=='success'){
$("#generateAadharOtpModal").css("max-height","280px");
$("#otp_sent_text").text(data.message);
$scope.isAadharOtpSubmitDisable = false;
$scope.isSendAadharOtpHidden = true;
}else if((data.status=='Failed') || (data.status=='error')){
$("#validation_error").text(data.message);
$scope.isSendAadharOtpHidden = false;
$scope.isAadharOtpSubmitDisable = true;
$scope.generateAadharOtp.aadhar_no = '';
$scope.generateAadharOtp.aadhar_no = '';
$scope.generateAadharOtp.aadhar_no = '';
}else{
$("#validation_error").text('Something went wrong. Please try again later.');
$scope.isSendAadharOtpHidden = false;
$scope.isAadharOtpSubmitDisable = true;
$scope.generateAadharOtp.aadhar_no = '';
$scope.generateAadharOtp.aadhar_no = '';
$scope.generateAadharOtp.aadhar_no = '';
}
});
}
};
$scope.closeAadharOtpModal = function () {
var response = confirm('Are you sure to cancel?');
if(response){
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
$('#generateAadharOtpModal').modal('toggle');
window.location.reload();
}
};
$scope.verifyGsOtp = function () {
$scope.isSendAadharOtpHidden = true;
$scope.isAadharOtpSubmitDisable = true;
$('#loader').css("display","block");
$("#loader-overlay").css("display","block");
var otp_code = $scope.generateAadharOtp.otp_code;
var regex = new RegExp(/(\b(?:([A-Za-z0-9])(?!\2{4}))+\b)/);//repeat more than 5 times
if(!(String(otp_code).match(/^\d{6}$/)) || !otp_code.match(regex))
{
$scope.isAadharOtpSubmitDisable = false;
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
swal(
'Invalid OTP Code',
'Please enter valid OTP code.'
);
return;
}
else
{
$scope.isAadharOtpSubmitDisable = true;
var requestData = {'otp_code': $scope.generateAadharOtp.otp_code,'otp_type': $scope.generateAadharOtp.aadhar_otp_type}
$http({
method: 'POST',
url: $scope.baseUrl + '/gsticket/verify-gs-otp',
transformRequest: 20,
params: {data: requestData},
headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}
}).success(function (data) {
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
$scope.alertMessage = data.message;
$scope.generateAadharOtp.otp_code = '';
if(data.status=='success'){
$scope.adharOtpVerificationCount = 0;
$("#otp_sent_text").text();
$scope.isAadharOtpSubmitDisable = true;
$scope.isSendAadharOtpHidden = true;
$('#generateAadharOtpModal').modal('toggle');
$("#gs_ticket_detail").css("display","block");
$("#gs_ticket_challan_row").css("display","none");
$scope.challanDetailForm = data.results;
$scope.randomGsSalt = data.randomGsSalt;
}else if((data.status=='Failed') || (data.status=='error')){
if($scope.adharOtpVerificationCount>=3){
$scope.adharOtpVerificationCount = 0;
$('#generateAadharOtpModal').modal('toggle');
$("#gs_ticket_detail").css("display","none");
$("#gs_ticket_challan_row").css("display","block");
$scope.alertMessage = 'OTP Invalid. Your maximum 3 attempts exceeded. Please try Again.';
}
$scope.adharOtpVerificationCount = ($scope.adharOtpVerificationCount + 1);
$scope.isAadharOtpSubmitDisable = false;
$scope.challanDetailForm = {};
swal({
icon:"error",
title:"<span style='color:red !important'>Error</span>",
html:$scope.alertMessage,
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.CLOSE
});
}else{
$scope.adharOtpVerificationCount = 0;
$('#generateAadharOtpModal').modal('toggle');
$("#gs_ticket_detail").css("display","none");
$("#gs_ticket_challan_row").css("display","block");
$scope.isAadharOtpSubmitDisable = false;
$scope.challanDetailForm = {};
swal({
icon:"error",
title:"<span style='color:red !important'>Error</span>",
html:'Something went wrong! Please try again later.',
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.CLOSE
});
}
});
}
};
$scope.submitForm = function (challanForm) {
$('#loader').css("display","block");
$("#loader-overlay").css("display","block");
$scope.invalidname = false;
var mobile_no = $('#phone').val();
$scope.generateAadharOtp.aadhar_no = '';
$scope.generateAadharOtp.mobile_no = '';
var otp_type = $scope.generateAadharOtp.otp_type;
if((otp_type == 'by_aadhar_mobile') && (angular.isUndefined(mobile_no) || mobile_no == '' || !(String(mobile_no).match(/^\d{10}$/)))) {
swal({
icon:"error",
title:"<span style='color:red !important'>Error!</span>",
html: "<h5 style='font-weight:bold; color:#4CAF50;'>"+lang.PLEASE_ENTER_VALID_MOBILE_NO+"</h5>",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
$('#phone').css('background-color', '#FFE4E1');
$('#phone').addClass('form-error');
$('#phone').focus();
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
var tmr = setInterval(function(){ $('#phone').css('background-color', '#FFFFFF'); $('#phone').removeClass('form-error'); clearInterval(tmr); }, 4000);
return false;
}
var email = $('#email').val();
if(email != '' && email != null)
{
if(email.length>50 || !(String(email).match(/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/))){
$scope.invalidname = true;
swal({
icon:"error",
title:"<span style='color:red !important'>Error!</span>",
html: "<h5 style='font-weight:bold; color:#4CAF50;'>"+lang.EMAIL_ENTERED_EXCEEDED_MAX_LIMIT+"</h5>",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
if(!(String(email).match(/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/))){
swal({
icon:"error",
title:"<span style='color:red !important'>Error!</span>",
html: "<h5 style='font-weight:bold; color:#4CAF50;'>"+lang.PLEASE_ENTER_VALID_EMAIL+"</h5>",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
}
$('#email').css('background-color', '#FFE4E1');
$('#email').addClass('form-error');
$('#email').focus();
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
var tmr = setInterval(function(){ $('#email').css('background-color', '#FFFFFF'); $('#email').removeClass('form-error'); clearInterval(tmr); }, 4000);
return false;
}
}
var issue_title = $('#issue').val();
if(issue_title == '' || issue_title == null)
{
$scope.invalidname = true;
swal({
icon:"error",
title:"<span style='color:red !important'>Error!</span>",
html: "<h5 style='font-weight:bold; color:#4CAF50;'>"+lang.PLEASE_SELECT_AN_ISSUE+"</h5>",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
$('#issue').css('background-color', '#FFE4E1');
$('#issue').addClass('form-error');
$('#issue').focus();
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
var tmr = setInterval(function(){ $('#issue').css('background-color', '#FFFFFF'); $('#issue').removeClass('form-error'); clearInterval(tmr); }, 4000);
return false;
}
var comment = $('#comment').val();
if(comment == '' || comment == null || comment.length>500)
{
$scope.invalidname = true;
swal({
icon:"error",
title:"<span style='color:red !important'>Error!</span>",
html: "<h5 style='font-weight:bold; color:#4CAF50;'>"+lang.PLEASE_ENTER_ISSUE_IN_COMMENT_BOX+"</h5>",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
if(comment.length>500){
swal({
icon:"error",
title:"<span style='color:red !important'>Error!</span>",
html: "<h5 style='font-weight:bold; color:#4CAF50;'>"+lang.ISSUE_DESCRIPTION_CAN_NOT_BE_EXCEEDED_THAN_500_CHARACTERS+"</h5>",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
}
$('#comment').css('background-color', '#FFE4E1');
$('#comment').addClass('form-error');
$('#comment').focus();
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
var tmr = setInterval(function(){ $('#comment').css('background-color', '#FFFFFF'); $('#comment').removeClass('form-error'); clearInterval(tmr); }, 4000);
return false;
}
var fcaptcha = $('#captcha').val();
if(fcaptcha == '' || fcaptcha == null || fcaptcha.length!=6)
{
$scope.invalidname = true;
swal({
icon:"error",
title:"<span style='color:red !important'>Error!</span>",
html: "<h5 style='font-weight:bold; color:#4CAF50;'>"+lang.PLEASE_ENTER_VALID_CAPTCHA+"</h5>",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
$('#captcha').css('background-color', '#FFE4E1');
$('#captcha').addClass('form-error');
$('#captcha').focus();
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
var tmr = setInterval(function(){ $('#captcha').css('background-color', '#FFFFFF'); $('#captcha').removeClass('form-error'); clearInterval(tmr); }, 4000);
return false;
}
$('#flashMsgContainerDiv').css("display","none");
var randomGsSalt = $('#randomGsSalt').val();
console.log("randomGsSalt::"+randomGsSalt);
var requestData = {
'email' : btoa(email),
'phone' : btoa(mobile_no),
'randomGsSalt' : btoa(randomGsSalt),
'issue' : btoa(issue_title),
'comment' : btoa(unescape(encodeURIComponent(comment))),
'captcha' : btoa(fcaptcha)
};
$('#loader').css("display","block");
$http({
url : $scope.baseUrl+'/gsticket/save-gs-form',
method: 'POST',
params: {data:requestData},
headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}
}).success(function(data) {
$('#loader').css("display","none");
$("#loader-overlay").css("display","none");
refreshCaptcha1();
if(data.status == 'success'){
$('#gsformdata')[0].reset();
$(".textarea_alert").text(lang.ONLY+' 500 '+lang.CHARACTERS_REMAINING_TO_WRITE+'....');
$('#blah').attr('src', '');
$('#blah').css({'display':'none'});
$("#gs_ticket_detail").css("display","none");
$("#gs_ticket_challan_row").css("display","block");
$scope.checkRadioButtonOtpbyAadhaar();
$scope.reSizePopup('by_aadhar_mobile');
swal({
icon:"success",
title:"<span style='color:green !important'>Success!</span>",
html: "<h5 style='font-weight:bold; color:#4CAF50;'>"+lang.ETICKET_NUMBER+data.ticket+"</h5><br><small>"+data.message+"</small>",
footer: data.message,
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
}else if(data.status == 'alert'){
$('#gsformdata')[0].reset();
$(".textarea_alert").text(lang.ONLY+' 500 '+lang.CHARACTERS_REMAINING_TO_WRITE+'....');
$('#blah').attr('src', '');
$('#blah').css({'display':'none'});
swal({
icon:"alert",
title:"<span style='color:red !important'>Error!</span>",
html: lang[data.message],
footer: "Please try again.",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
}else{
$scope.challanForm.captcha = '';
swal({
icon:"error",
title:"<span style='color:red !important'>Error!</span>",
html: lang[data.message],
footer: "Please try again.",
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
}
});
};
//----------------------------- END -----------------------------------------------
function validate(field) {
$('#'+field).css('background-color', '#FFE4E1');
$('#'+field).addClass('form-error');
$('#'+field).focus();
var tmr = setInterval(function(){ $('#'+field).css('background-color', '#FFFFFF'); $('#'+field).removeClass('form-error'); }, 3000);
}
$scope.goBackBtnClick = function () {
$('#login_otp').val('');
$('#step2').css('display', 'none');
if($scope.login_ip_status == 'new') {
$('#step1').css('display', 'none');
$('#step_otp').css('display', 'block');
} else {
$('#step1').css('display', 'block');
$('#step_otp').css('display', 'none');
}
}
$scope.getSearch = function (challanForm) {
//console.log("clicked....");
$scope.invalidname = false;
var e_ticket = $('#e_ticket').val();
var captcha = $('#captcha').val();
if(e_ticket == '' || e_ticket == null)
{
$scope.invalidname = true;
$('#flashMsgContainerDiv').css("display","block");
$('#flashMsgContainer').text(lang.PLEASE_ENTER_VALID_E_TICKET_NUMBER); //Language Setting
$('#e_ticket').css('background-color', '#FFE4E1');
$('#e_ticket').addClass('form-error');
$('#e_ticket').focus();
var tmr = setInterval(function(){ $('#e_ticket').css('background-color', '#FFFFFF'); $('#e_ticket').removeClass('form-error'); clearInterval(tmr); }, 4000);
return false;
}
if(captcha == '' || captcha == null)
{
$scope.invalidname = true;
$('#flashMsgContainerDiv').css("display","block");
$('#flashMsgContainer').text(lang.PLEASE_ENTER_VALID_CAPTCHA); //Language Setting
$('#captcha').css('background-color', '#FFE4E1');
$('#captcha').addClass('form-error');
$('#captcha').focus();
var tmr = setInterval(function(){ $('#captcha').css('background-color', '#FFFFFF'); $('#captcha').removeClass('form-error'); clearInterval(tmr); }, 4000);
return false;
}
var requestData = { 'e_ticket' : e_ticket, 'captcha' : captcha };
$http({
url : $scope.baseUrl + '/gsticket/gs-ticket-search',
method: 'POST',
params: {data:requestData},
headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}
}).success(function(data) {
refreshCaptcha1();
var title = '';
var htmlText = "<h5 style='font-weight:bold; color:#dd655c;font-size:20px'>"+lang[data.message]+"</h5>";
if(data.status=='success'){
title = "<span style='font-size:25px !important;color:#4CAF50'>"+lang.TICKET_STATUS+" - "+data.gstatus+"</span>";
if((data.gstatus=='Accepted') && (data.remark!='')){
htmlText = "<h5 style='font-weight:bold; color:#4CAF50;font-size:20px'>Your ticket has been addressed by the concerned officer with remarks - </h5><br><h7 style='color:#4CAF50;'>"+data.remark+".</h7><br/><br/><h7 style='color:#4CAF50;'>For more detail <a href='"+$scope.baseUrl + "/index/accused-challan' target='_blank'>click here.</a></h7>";
}
else if((data.gstatus=='Under Investigation') && (data.remark!='')){
htmlText = "<h5 style='font-weight:bold; color:#4CAF50;font-size:20px'>Your ticket has been addressed by the concerned officer with remarks - </h5><br><h7 style='color:#4CAF50;'>"+data.remark+".</h7>";
}
else if((data.gstatus=='Rejected') && (data.remark!='')){
htmlText = "<h5 style='font-weight:bold; color:#4CAF50;font-size:20px'>Your ticket has been rejected by the concerned officer with remarks - </h5><br><h7 style='color:#4CAF50;'>"+data.remark+".</h7>";
}
else if((data.gstatus=='Accepted') || (data.gstatus=='Rejected') || (data.gstatus=='Under Investigation')){
htmlText = "<br/><h7 style='color:#4CAF50;'>For more detail <a href='"+$scope.baseUrl + "/index/accused-challan' target='_blank'>click here.</a></h7>";
}
else if(data.gstatus=='Pending'){
htmlText = "<h5 style='font-weight:bold; color:#4CAF50;font-size:20px'>"+data.message+"</h5>";
}
else{
htmlText = '';
}
}
swal({
icon: 'success',
title: title,
html: htmlText,
footer: data.remark,
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
});
});
};
//--------------------------------- END -------------------------------
$scope.showPopup = function (type) {
if(type == 'what_echallan') {
swal({
customClass: 'swal-wide',
html: '<div style="text-align: left"><b> '+lang.WHAT_IS_E_CHALLAN+' </b> <br/>' +
lang.WHAT_IS_ECHALLAN_PARA_1 +' <br/>' +
' <br/>'+lang.WHAT_IS_ECHALLAN_PARA_2+' '+lang.APPLICATION_OFFERS_CUSTOMIZED_INTERFACES_FOR_FOLLOWING_STAKEHOLDERS+'<br/>' +
'&#8227; '+lang.ENFORCEMENT_OFFICERS+' <br/>' +
'&#8227; '+lang.CITIZENS_PRIVATE_OR_COMMERCIAL_CAR_OWNERS_DRIVERS+'<br/>' +
'&#8227; '+lang.STATE_TRANSPORT_OFFICE+' <br/>' +
'&#8227; '+lang.REGIONAL_TRANSPORT_TRAFFIC_OFFICE+' <br/>' +
'&#8227; '+lang.NIC_ADMIN+' <br/>' +
'&#8227; '+lang.MINISTRY_OF_ROAD_AND_TRANSPORT+' <br/><br/>' +
lang.WHAT_IS_ECHALLAN_PARA_3 +' <br/><br/>' + lang.WHAT_IS_ECHALLAN_PARA_4
+
'</div>', //Language Setting
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
}
);
}else if(type == 'core_benefits') {
swal({
customClass: 'swal-wide',
html: '<div style="text-align: left"><b>'+lang.CORE_BENEFITS+' </b> <br/>' +
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_1+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_2+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_3+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_4+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_5+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_6+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_7+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_8+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_9+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_10+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_11+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_12+
' <br/>&#8227; '+ lang.CORE_BENEFIT_HEADING_13+
'</div>', //Language Setting
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
}
);
}else if(type == 'enablers') {
swal({
customClass: 'swal-wide',
html: '<div style="text-align: left"><b>' +lang.E_CHALLAN_ENABLERS+' </b> <br/>' +
' &#8227;'+lang.GOVERNMENT_PROCESS_REENGINEERING+' <br/>' +
lang.ECHALLAN_ENABLERS_PARA_1+'<br/>' +
'&#8227;'+lang.CAPACITY_BUILDING+' <br/>' +
lang.ECHALLAN_ENABLERS_PARA_2+'<br/>' +
'&#8227;'+lang.STATE_WISE_DEPARTMENT_WISE_CUSTOMIZATION+'<br/>' +
lang.ECHALLAN_ENABLERS_PARA_3+'<br/>' +
'</div>', //Language Setting
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
}
);
}else if(type == 'value_indicators') {
swal({
customClass: 'swal-wide',
html: '<div style="text-align: left"><b> '+lang.VALUE_INDICATORS+' </b> <br/>' +
'&#8227;'+lang.LEARNINGS_FOR_SHARING+' <br/>' +
lang.VALUE_INDICATORS_PARA_1+'<br/>' +
'&#8227; '+lang.DIGITAL_EMPOWERMENT+' <br/>' +
lang.VALUE_INDICATORS_PARA_2+'<br/><br/>' +
lang.VALUE_INDICATORS_PARA_3+'<br/><br/>' +
lang.VALUE_INDICATORS_PARA_4+
'</div>', //Language Setting
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.OK
}
);
}
if(type == 'important_alert') {
swal({
title: '<strong style="color: red;">'+lang.IMPORTANT_NOTICE+'</strong>',
customClass: 'swal-wide swal-border',
html:
lang.AS_PER_ADVISORY_ISSUED_MORTH_REQUESTING_TO_ALL_STATES_AND_UNION_TERRITORIES_TO_TREAT_DOCUMENTS,
showCloseButton: false,
showCancelButton: false,
confirmButtonText:lang.CLOSE
});
}
}
//--------------------------------- END -------------------------------
}
angular.module('echallan')
.controller('GsticketController', ['$scope', 'requestHandler', '$http', 'authService', 'md5', '$timeout', '$cookieStore', '$window', GsticketController]);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,947 @@
'use strict';
/* App Module */
(function (module) {
module
.directive('register', ["$compile", function ($compile) {
return {
controller: IndexController,
templateUrl: defaultUrl + '/www/module/directives/templates/index/register.html',
};
}])
.directive('wmBlock', function ($parse) {
return {
scope: {
wmBlockLength: '='
},
link: function (scope, elm, attrs) {
elm.bind('keypress', function(e){
if(elm[0].value.length > scope.wmBlockLength){
e.preventDefault();
return false;
}
});
}
}
})
.directive('indexAlerts', ["$compile", function ($compile) {
return {
controller: IndexController,
templateUrl: defaultUrl + '/www/module/directives/templates/alerts/index.html',
};
}])
.directive('filters', ["$compile", function ($compile) {
return {
// controller: DashboardController,
controller : "@",
name:"controllerName",
templateUrl: defaultUrl + '/www/module/directives/templates/dashboard/filters.html'
};
}])
.directive('cards', ["$compile", function ($compile) {
return {
controller: DashboardController,
templateUrl: defaultUrl + '/www/module/directives/templates/dashboard/cards.html',
};
}])
.directive('challanInfo', ["$compile", function ($compile) {
return {
controller: DashboardController,
templateUrl: defaultUrl + '/www/module/directives/templates/dashboard/challan-info.html',
};
}])
.directive('challanList', ["$compile", function ($compile) {
return {
controller: DashboardController,
templateUrl: defaultUrl + '/www/module/directives/templates/dashboard/challan-list.html',
};
}])
.directive('designationList', ["$compile", function ($compile) {
return {
controller: DesignationController,
templateUrl: defaultUrl + '/www/module/directives/templates/designation/designation-list.html',
};
}])
.directive('circleList', ["$compile", function ($compile) {
return {
controller: CircleController,
templateUrl: defaultUrl + '/www/module/directives/templates/circle/circle-list.html',
};
}])
.directive('bookList', ["$compile", function ($compile) {
return {
controller: ChallanBookController,
templateUrl: defaultUrl + '/www/module/directives/templates/challan-book/book-list.html',
};
}])
.directive('courtList', ["$compile", function ($compile) {
return {
controller: CourtController,
templateUrl: defaultUrl + '/www/module/directives/templates/courts/court-list.html',
};
}])
.directive('apkList', ["$compile", function ($compile) { console.log('here');
return {
controller: ApkController,
templateUrl: defaultUrl + '/www/module/directives/templates/apk/apk-list.html',
};
}])
.directive('officersList', ["$compile", function ($compile) {
return {
controller: OfficerController,
templateUrl: defaultUrl + '/www/module/directives/templates/officer/officers-list.html',
};
}])
.directive('targetChallanList', ["$compile", function ($compile) {
return {
controller: TargetChallanController,
templateUrl: defaultUrl + '/www/module/directives/templates/target-challan/target-challan-list.html',
};
}])
.directive('tutorialVideoList', ["$compile", function ($compile) { //console.log('here');
return {
controller: DashboardController,
templateUrl: defaultUrl + '/www/module/directives/templates/dashboard/tutorial-video-list.html',
};
}])
/*.directive('appChallanList', ["$compile", function ($compile) {
return {
controller: AppChallanController,
templateUrl: defaultUrl + '/www/module/directives/templates/app-challan/app-challan-list.html',
};
}])
.directive('appChallanFilters', ["$compile", function ($compile) {
return {
controller: AppChallanController,
templateUrl: defaultUrl + '/www/module/directives/templates/app-challan/app-challan-filters.html',
};
}])*/
.directive('branchVoice', ["$compile", function ($compile) {
return {
controller : "@",
name:"controllerName",
templateUrl: defaultUrl + '/www/module/directives/templates/analytics/branch-voice.html',
};
}])
.directive('newRole', ["$compile", function ($compile) {
return {
controller: AdminController,
templateUrl: defaultUrl + '/www/module/directives/templates/admin/new-role.html',
};
}])
.directive('editRole', ["$compile", function ($compile) {
return {
controller: AdminController,
templateUrl: defaultUrl + '/www/module/directives/templates/admin/edit-role.html',
};
}])
.directive('listRole', ["$compile", function ($compile) {
return {
controller: AdminController,
templateUrl: defaultUrl + '/www/module/directives/templates/admin/list-role.html',
};
}])
.directive('adminAlerts', ["$compile", function ($compile) {
return {
controller: AdminController,
templateUrl: defaultUrl + '/www/module/directives/templates/alerts/index.html',
};
}])
.directive('listJob', ["$compile", function ($compile) {
return {
controller: JobController,
templateUrl: defaultUrl + '/www/module/directives/templates/jobs/list-job.html',
};
}])
.directive('listOfficer', ["$compile", function ($compile) {
return {
controller: JobController,
templateUrl: defaultUrl + '/www/module/directives/templates/jobs/list-officer.html',
};
}])
.directive('assignJob', ["$compile", function ($compile) {
return {
controller: JobController,
templateUrl: defaultUrl + '/www/module/directives/templates/jobs/assign-job.html',
};
}])
.directive('jobAlerts', ["$compile", function ($compile) {
return {
controller: JobController,
templateUrl: defaultUrl + '/www/module/directives/templates/alerts/index.html',
};
}])
.directive('messagePanel', ["$compile", function ($compile) {
return {
controller: InboxController,
templateUrl: defaultUrl + '/www/module/directives/templates/inbox/message-panel.html',
};
}])
.directive('editUserPanel', ["$compile", function ($compile) {
return {
controller: ManageUsersController,
templateUrl: defaultUrl + '/www/module/directives/templates/manage-users/edit-user.html',
};
}])
.directive('feedbackList', ["$compile", function ($compile) {
return {
controller: FeedbackController,
templateUrl: defaultUrl + '/www/module/directives/templates/feedback/feedback-list.html',
};
}])
.directive('newDevice', ["$compile", function ($compile) {
return {
controller: ManageDeviceController,
templateUrl: defaultUrl + '/www/module/directives/templates/manage-device/new-device.html',
};
}])
.directive('listDevice', ["$compile", function ($compile) {
return {
controller: ManageDeviceController,
templateUrl: defaultUrl + '/www/module/directives/templates/manage-device/list-device.html',
};
}])
.directive('listDeviceRequests', ["$compile", function ($compile) {
return {
controller: ManageDeviceController,
templateUrl: defaultUrl + '/www/module/directives/templates/manage-device/list-device-requests.html',
};
}])
.directive('deviceAlerts', ["$compile", function ($compile) {
return {
controller: ManageDeviceController,
templateUrl: defaultUrl + '/www/module/directives/templates/alerts/index.html',
};
}])
.directive('suspendedDevice', ["$compile", function ($compile) {
return {
controller: ManageDeviceController,
templateUrl: defaultUrl + '/www/module/directives/templates/manage-device/suspended-device.html',
};
}])
.directive('rejectedDevice', ["$compile", function ($compile) {
return {
controller: ManageDeviceController,
templateUrl: defaultUrl + '/www/module/directives/templates/manage-device/rejected-device.html',
};
}])
.directive('listVehicle', ["$compile", function ($compile) {
return {
controller: ManageVehicleController,
templateUrl: defaultUrl + '/www/module/directives/templates/manage-vehicle/list-vehicle.html',
};
}])
.directive('addVehicle', ["$compile", function ($compile) {
return {
controller: ManageVehicleController,
templateUrl: defaultUrl + '/www/module/directives/templates/manage-vehicle/add-vehicle.html',
};
}])
.directive('vehicleAlerts', ["$compile", function ($compile) {
return {
controller: ManageVehicleController,
templateUrl: defaultUrl + '/www/module/directives/templates/alerts/index.html',
};
}])
.directive('compareGraph', ["$compile", function ($compile) {
return {
controller: DataPanelController,
templateUrl: defaultUrl + '/www/module/directives/templates/analytics/compare-graph.html',
};
}])
.directive('challanRate', ["$compile", function ($compile) {
return {
controller: DataPanelController,
scope: {
details: '@details',
},
templateUrl: defaultUrl + '/www/module/directives/templates/analytics/challan-rate-graph.html',
};
}])
.directive('officerHistory', ["$compile", function ($compile) {
return {
controller: DataPanelController,
templateUrl: defaultUrl + '/www/module/directives/templates/analytics/officer-history.html'
};
}])
.directive('challanHistory', ["$compile", function ($compile) {
return {
controller: HistoryController,
templateUrl: defaultUrl + '/www/module/directives/templates/history/challan-history.html'
};
}])
.directive('notificationList', ["$compile", function ($compile) {
return {
controller: InboxController,
templateUrl: defaultUrl + '/www/module/directives/templates/inbox/notification-list.html'
};
}])
.directive('detailTab', ["$compile", function ($compile) {
return {
scope:{
type:'@type'
},
templateUrl: defaultUrl + '/www/module/directives/templates/circle/tabs.html'
};
}])
.directive('tabLoader', ["$compile", function ($compile) {
return {
templateUrl: defaultUrl + '/www/module/directives/templates/dashboard/tab-loader.html',
};
}])
.directive('reportDetail', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/report-detail.html'
};
}])
.directive('reportData', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/report-data.html',
link: function ($scope, elem, attrs) {
}
};
}])
.directive('cashierData', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/cashier-data.html',
link: function ($scope, elem, attrs) {
}
};
}])
.directive('cashierChallans', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/cashier-challans.html',
link: function ($scope, elem, attrs) {
}
};
}])
.directive('reportFilters', ["$compile", function ($compile) {
return {
controller: ReportController,
//controller : "@",
//name:"controllerName",
templateUrl: defaultUrl + '/www/module/directives/templates/report/report-filters.html'
};
}])
/** send to rta by mayank start **/
.directive('userWiseReport', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/rto-transfer/user-wise-report.html'
};
}])
.directive('dateWiseReport', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/rto-transfer/date-wise-report.html'
};
}])
.directive('locationWiseReport', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/rto-transfer/location-wise-report.html'
};
}])
.directive('trafficTransferredReport', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/rto-transfer/traffic-transferred-report.html'
};
}])
/** send to rta by mayank end **/
/*code added here by neha shaw on 29-10-2020 start*/
.directive('rtoTransferFilters', ["$compile", function ($compile) {
return {
controller: RtoTransferController,
templateUrl: defaultUrl + '/www/module/directives/templates/rto-transfer/rto-transfer-filters.html'
};
}])
/*code added here by neha shaw on 29-10-2020 end*/
.directive('challanBookFilter', ["$compile", function ($compile) {
return {
controller :ChallanBookController,
templateUrl: defaultUrl + '/www/module/directives/templates/challan-book/filters.html',
};
}])
.directive('manageBookList', ["$compile", function ($compile) {
return {
controller: ChallanBookController,
templateUrl: defaultUrl + '/www/module/directives/templates/challan-book/manage-book-list.html',
};
}])
.directive('atcData', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/atc-data.html',
};
}])
.directive('dtcData', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/dtc-data.html',
};
}])
.directive('ngoList', ["$compile", function ($compile) {
return {
controller: NgoController,
templateUrl: defaultUrl + '/www/module/directives/templates/ngo/ngo-list.html',
};
}])
.directive('officerPaymentList', ["$compile", function ($compile) {
return {
controller: OfficerPaymentController,
templateUrl: defaultUrl + '/www/module/directives/templates/officers-payment/officers-payment-list.html',
};
}])
.directive('vehicleHistory', ["$compile", function ($compile) {
return {
controller: HistoryController,
templateUrl: defaultUrl + '/www/module/directives/templates/history/vehicle-history.html'
};
}])
.directive('readonlyChallanHistory', ["$compile", function ($compile) {
return {
controller: HistoryController,
templateUrl: defaultUrl + '/www/module/directives/templates/history/readonly-challan-history.html'
};
}])
.directive('reassignBookList', ["$compile", function ($compile) {
return {
controller: ChallanBookController,
templateUrl: defaultUrl + '/www/module/directives/templates/challan-book/reassign-book-list.html',
};
}])
.directive('starRating', function () {
return {
restrict: 'A',
template: '<ul class="rating">' +
'<li ng-repeat="star in stars" ng-class="star" ng-click="toggle($index)">' +
'\u2605' +
'</li>' +
'</ul>',
scope: {
ratingValue: '=',
max: '=',
onRatingSelected: '&'
},
link: function (scope, elem, attrs) {
var updateStars = function () {
scope.stars = [];
for (var i = 0; i < scope.max; i++) {
scope.stars.push({
filled: i < scope.ratingValue
});
}
};
scope.toggle = function (index) {
scope.ratingValue = index + 1;
scope.onRatingSelected({
rating: index + 1
});
};
scope.$watch('ratingValue', function (oldVal, newVal) {
if (newVal) {
updateStars();
}
});
}
}
})
.directive('fileModel', ['$parse', function ($parse) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var model = $parse(attrs.fileModel);
var modelSetter = model.assign;
element.bind('change', function(){
scope.$apply(function(){
modelSetter(scope, element[0].files[0]);
});
});
}
};
}])
.directive('rtoData', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/rto-data.html',
};
}])
.directive('officerData', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/officer-data.html',
};
}])
.filter('capitalize', function() {
return function(input) {
return (!!input) ? input.charAt(0).toUpperCase() + input.substr(1).toLowerCase() : '';
}
})
.directive('artoOfficerData', ["$compile", function ($compile) {
return {
controller: ReportController,
templateUrl: defaultUrl + '/www/module/directives/templates/report/arto-officer-data.html',
};
}])
.directive('editRecordPanel', ["$compile", function ($compile) {
return {
controller: RecordRoomController,
templateUrl: defaultUrl + '/www/module/directives/templates/record-room/edit-user.html',
};
}])
.directive('knob', function() {
function link( scope, element , attr ) {
function draw() {
element.empty();
var tmpl = $('<input type="text" style="color:red !important;">');
var min = attr.min ? parseInt(attr.min) : 0;
var max = attr.max ? parseInt(attr.max) : 0;
var val = attr.value ? parseInt(attr.value) : "";
var readonly = attr.readonly == "true" ? true : false;
var sign = attr.sign ? attr.sign : "";
var fgColor = "red"; //green - success
var dangerLimit = attr.dangerLowerThen;
var warnLimit = attr.warnLowerThen;
if(dangerLimit && val < dangerLimit) {
fgColor = "red"; //red - danger
} else if(warnLimit && val < warnLimit) {
fgColor = "green"; //yellow - warning
}
element.append(tmpl);
var options = {
// value : 0,
min : min,
max : max > val ? max : val,
dynamicDraw: true,
step : 5,
angleOffset : 0,
angleArc : 360,
fgColor : fgColor,
inputColor:fgColor,
readOnly : readonly,
cursor : false,
lineCap : 'butt',
thickness : '0.1',
width : 170,
displayInput : true,
displayPrevious : true,
font : 'Arial',
fontWeight : 'normal',
bgColor : '#EEEEEE',
rtl : (attr.dir == 'rtl' ? true : false),
draw : function () { $(this.i).val(this.cv + sign); }
};
// var options = {
// value:0,
// min : 0,
// max : 100,
// step : 5,
// angleOffset : 0,
// angleArc : 360,
// //stopper : true,
// //readOnly : false,
// cursor : false,
// lineCap : 'butt',
// thickness : '0.1',
// width : 170,
// displayInput : true,
// displayPrevious : true,
// font : 'Arial',
// fontWeight : 'normal',
// bgColor : '#EEEEEE',
// draw : function () {
// $(this.i).val(this.cv + '%');
// }
// };
tmpl.knob(options);
tmpl.animate({
value: 100
}, {
duration: 1000,
easing: 'swing',
progress: function () {
$(this).val(Math.round(this.value/100 * val)).trigger('change');
}
})
}
scope.$watch(function () {
return [attr.value, attr.max, attr.min , attr.readonly];
}, draw, true);
}
return {
priority: 99,
restrict: 'A',
link : link
};
})
.filter('getDateFormat', function(){
return function(date,format){
if(date == '' || date == 'NA') {
return 'No Survey';
}
var validDateObj = new Date(date);
if(validDateObj.getFullYear() == 1970){
return 'No Survey';
}
var weekday = ['Sun','Mon','Tue','Wed','Thu','Fri', 'Sat'];
var monthName = ['Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec'];
var monthFullName = ['January','February','March','April','May','June', 'July','August','September','October','November','December'];
date = date.replace(/-/g, '/');
var dateOut = new Date(date);
var timeType = (dateOut.getHours() >= 12) ? 'PM' : 'AM';
var dateHour = (dateOut.getHours() >= 12) ? (dateOut.getHours() - 12) : dateOut.getHours();
var hrs = dateOut.getHours();
if (hrs > 12) {
hrs -= 12;
} else if (hrs === 0) {
hrs = 12;
} if (hrs < 10){
hrs = '0'+ hrs;
}
var mins = dateOut.getMinutes();
if (mins < 10) {
mins = '0'+ mins;
}
var sec = dateOut.getSeconds();
if (sec < 10) {
sec = '0'+ sec;
}
var dd = dateOut.getDate();
if (dd < 10) {
dd = '0'+ dd;
}
var mm = dateOut.getMonth();
mm = mm+1;
if (mm < 10) {
mm = '0'+ mm;
}
if(format =='custom1'){
var formatedDate = (dateOut.getDate()<10?'0':'')+dateOut.getDate() + "-" +
((dateOut.getMonth()+1)<10?'0':'')+(dateOut.getMonth()+1)+ "-" +
dateOut.getFullYear() + " " +
hrs + ":" +
mins+ " " + timeType;
return formatedDate;
}
if(format == 'customYearOnly'){
var formatedDate = dateOut.getFullYear();
return formatedDate;
}
if(format == 'customYearMonthOnly'){
var formatedDate = (monthFullName[dateOut.getMonth()])+" "+dateOut.getFullYear();
return formatedDate;
}
if(format == 'customYearMonthDayOnly'){
var formatedDate =
((dateOut.getDate())<10?'0':'')+(dateOut.getDate())+" "+
(monthFullName[dateOut.getMonth()])+" "+dateOut.getFullYear();
return formatedDate;
}
if(format =='customBasicDate'){
var formatedDate = (dateOut.getDate()<10?'0':'')+dateOut.getDate() + "-" +
((dateOut.getMonth()+1)<10?'0':'')+(dateOut.getMonth()+1)+ "-" +
dateOut.getFullYear();
return formatedDate;
}
if(format =='customYear'){
var formatedDate = dateOut.getFullYear();
return formatedDate;
}
if(format =='customMonthYear'){
var formatedDate = ((monthName[dateOut.getMonth()]+1)<10?'0':'')+(dateOut.getMonth()+1)+ "-" +
dateOut.getFullYear();
return formatedDate;
}
if(format){
var formatedDate = dateOut.getDate() + " " +
monthName[dateOut.getMonth()]+ " " +
dateOut.getFullYear() + " " +
hrs + ":" +
mins+ " " + timeType;
return formatedDate;
}
var formatedDate = weekday[dateOut.getDay()] + ", " +
dateOut.getDate() + " " +
monthName[dateOut.getMonth()]+ " " +
dateOut.getFullYear() + " " +
hrs + ":" +
mins+ ":" +sec+ " " + timeType;
// var formatedDate = dd + "-" +
// mm + "-" +
// dateOut.getFullYear() + " " +
// hrs + ":" +
// mins + " " + timeType;
return formatedDate;
};
})
.directive('noSpecialChar', function() {
return {
require: 'ngModel',
restrict: 'A',
link: function(scope, element, attrs, modelCtrl) {
modelCtrl.$parsers.push(function(inputValue) {
if (inputValue == null)
return '';
var cleanInputValue = inputValue.replace(/[^\w\s]/gi, '');
if (cleanInputValue != inputValue) {
modelCtrl.$setViewValue(cleanInputValue);
modelCtrl.$render();
}
return cleanInputValue;
});
}
}
})
.directive('numberValidate', function() {
return {
require: 'ngModel',
restrict: 'A',
link: function(scope, element, attrs, modelCtrl) {
modelCtrl.$parsers.push(function(inputValue) {
if (inputValue == null)
return '';
var cleanInputValue = inputValue.replace(/[^0-9\\,\\.\\;]/g, '');
if (cleanInputValue != inputValue) {
modelCtrl.$setViewValue(cleanInputValue);
modelCtrl.$render();
}
return cleanInputValue;
});
}
}
})
.directive('courtChallan', ["$compile", function ($compile) {
return {
controller: CourtChallanController,
templateUrl: defaultUrl + '/www/module/directives/templates/court/court-challan.html'
};
}])
//START OF BULK PRINT COURT CHALLAN
.directive('courtChallanPrint', ["$compile", function ($compile) {
return {
controller: CourtChallanController,
templateUrl: defaultUrl + '/www/module/directives/templates/court/court-challan-print.html'
};
}])
//END OF BULK PRINT COURT CHALLAN
.directive('courtChallans', ["$compile", function ($compile) {
return {
controller: CourtChallanController,
templateUrl: defaultUrl + '/www/module/directives/templates/court-challan/court-challans.html'
};
}])
.directive('printChallan', ["$compile", function ($compile) {
return {
controller: PrintChallanController,
templateUrl: defaultUrl + '/www/module/directives/templates/print-challan/court-challan.html'
};
}])
.directive('checkImage', function($http) {
return {
restrict: 'A',
scope: {
img: '=',
state: '=',
folder: '=',
},
link: function(scope, element, attrs) {
attrs.$observe('ngSrc', function(ngSrc) {
imageExists(ngSrc, function(exists) {
if (exists) {
element.attr("src", ngSrc);
}else{
ngSrc = defaultUrl+'/www/img2/challans/'+scope.state+'/'+attrs.folder+'/'+scope.img;
imageExists(ngSrc, function(exists) {
if (exists) {
element.attr("src", ngSrc);
return true;
}else{
// element.attr("src", defaultUrl+'/www/img/no_image.png');
ngSrc = defaultUrl+'/www/img2/challans/'+scope.state+'/'+attrs.folder+'/'+scope.img;
imageExists(ngSrc, function(exists) {
if (exists) {
element.attr("src", ngSrc);
return true;
}else{
//element.attr("src", defaultUrl+'/www/img/no_image.png');
ngSrc = defaultUrl+'/www/img2/challans/'+scope.img;
imageExists(ngSrc, function(exists) {
if (exists) {
element.attr("src", ngSrc);
return true;
}else{
element.attr("src", defaultUrl+'/www/img/no_image.png');
}
});
}
});
}
});
}
});
});
}
};
});
function imageExists(url, callback) {
var img = new Image();
img.onload = function() {
callback(true);
};
img.onerror = function() {
callback(false);
};
img.src = url;
}
}(angular.module('echallan')));

View File

@@ -0,0 +1,61 @@
'use strict';
(function(module){
function authService(authCredential, $sessionStorage, $q){
return {
"setCredential" : setCredential,
"getCredential" : getCredential,
"getAuthToken" : getAuthToken,
"updateAuthToken" : updateAuthToken,
"clearCredential" : clearCredential,
"isAuthorized" : isAuthorized
};
function isAuthorized(authorizedRoles){
return true;
};
function updateAuthToken(token) {
return $sessionStorage.authCredential.auth_token = token;
}
function setCredential(dataSet){
authCredential.auth_token = dataSet.auth_token;
authCredential.userData = dataSet.userData;
authCredential.userId = dataSet.userData.id;
authCredential.privilegesCode = dataSet.privilegesCode;
$sessionStorage.authCredential = authCredential;
}
function getCredential(){
return $sessionStorage.authCredential;
}
function getAuthToken(){
if($sessionStorage && $sessionStorage.authCredential && $sessionStorage.authCredential.auth_token)
return $sessionStorage.authCredential.auth_token;
else
return null;
}
function clearCredential(){
$sessionStorage.authCredential = "";
}
}
function authCredential(){
return {
auth_token : null,
userId : null,
userData : null,
privilegesCode : null,
dateTime : null
};
}
module
.factory('authService',['authCredential','$sessionStorage', '$q', authService])
.factory('authCredential', authCredential)
}(angular.module('echallan')));

View File

@@ -0,0 +1,148 @@
'use strict';
(function(module){
function requestHandler($http, $q){
return{
prepareRequest : prepareRequest,
preparePostRequest : preparePostRequest,
prepareGetRequest : prepareGetRequest,
prepareAttachmentRequest : prepareAttachmentRequest
}
var postParam = {
method : 'POST',
url : '',
data : '',
headers : {'Content-Type': 'application/x-www-form-urlencoded'},
transformRequest : false
}
var getParam = {
method : 'GET',
url : '',
}
function prepareRequest(method, param){
var requestParam = (method.toUpperCase() == 'POST') ? $.extend({}, postParam, param) : $.extend({}, getParam, param);
if(method.toUpperCase() == 'POST'){
requestParam.data = (requestParam.data) ? $.param(requestParam.data) : "";
}
return $http(requestParam)
.then(sendResponseData )
.catch(sendResponseError);
}
function prepareAttachmentRequest($param) {
//-------old code----------
// return $http({
// method : 'POST',
// url : $param.url,
// data : $param.data,
// processData: false,
// contentType: false,
// headers: {'Content-Type': undefined},
// transformRequest: angular.identity
// })
// .then(sendResponseData )
// .catch(sendResponseError )
$param.data.append('ajax' ,true);
var dataSet = $http({
method : 'POST',
url : $param.url,
data : $param.data,
processData: false,
contentType: false,
headers: {'Content-Type': undefined},
transformRequest: angular.identity
}).then(sendResponseData)
.catch(sendResponseError);
dataSet.then(function (data) {
//console.log(data);
if (data.status == 203) {
window.location.replace(defaultUrl+"/index");
}
})
return dataSet;
}
function preparePostRequest($param) {
$param.data = ($param.data) ? $.param($param.data) : "";
$param.data = $param.data+'&ajax=true';
// var token = authService.getAuthToken();
// if(token) {
// var tokenSet = $.param({data : {'auth_token' : token, 'request_type' : 'ajax' }});
// $param.data = ($param.data) ? $param.data+'&'+tokenSet : tokenSet;
//
// }
//------Old request-------
// return $http({
// method : 'POST',
// url : $param.url,
// data : $param.data,
// headers : {'Content-Type': 'application/x-www-form-urlencoded'},
// transformRequest : false
// })
// .then(sendResponseData )
// .catch(sendResponseError )
var dataSet = $http({
method : 'POST',
url : $param.url,
data : $param.data,
headers : {'Content-Type': 'application/x-www-form-urlencoded'},
transformRequest : false
}).then(sendResponseData)
.catch(sendResponseError);
dataSet.then(function (data) {
// console.log(defaultUrl);
if (data.status == 203) {
window.location.replace(defaultUrl+"/index");
}
})
return dataSet;
}
function prepareGetRequest($param){
return $http({
method : 'GET',
url : $param.url,
})
.then(sendResponseData )
.catch(sendResponseError )
}
function sendResponseData(response) {return response.data;}
function sendResponseError(response) {
//return $q.reject('Error retrieving book(s). (HTTP status: ' + response.status + ')');
//return $q.reject('Error retrieving book(s). (HTTP status: ' + response.status + ')');
}
};
function stateParamService(){
return {
params : {}
};
}
module
.factory('requestHandler', ['$http', '$q', requestHandler])
.factory('stateParamService', [stateParamService])
// ------------- data service ----------------
}(angular.module('echallan')));