Subversion Repositories SmartDukaan

Rev

Rev 34813 | Rev 34825 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34813 Rev 34818
Line 739... Line 739...
739
});
739
});
740
 
740
 
741
const emailId = getCookie('emailId');
741
const emailId = getCookie('emailId');
742
console.log("Email ID:", emailId);
742
console.log("Email ID:", emailId);
743
 
743
 
744
$(document).ready(function () {
744
function showModal() {
745
	$(this).removeAttr('aria-hidden');
745
	$('#partnerTasks').removeAttr('aria-hidden');
746
	$(this).focus();
-
 
747
	$('#partnerTasks').modal('show');
-
 
748
 
746
 
749
	if (!emailId || !emailId.endsWith('@smartdukaan.com')) {
747
	if (!emailId || !emailId.endsWith('@smartdukaan.com')) {
750
		// Show loader manually before AJAX call
-
 
751
		$('#chartData').html('<div class="loader text-center " style=" height: 30px;\n' +
748
		$('#chartData').html('<div class="loader text-center " style=" height: 30px;\n' +
752
			'    display: flex;\n' +
749
			'    display: flex;\n' +
753
			'    justify-content: center;\n' +
750
			'    justify-content: center;\n' +
754
			'    align-items: center;\n' +
751
			'    align-items: center;\n' +
755
			'    font-size: 1.5rem;\n' +
752
			'    font-size: 1.5rem;\n' +
756
			'    font-weight: 200;\n' +
753
			'    font-weight: 200;\n' +
757
			'    color: #555;" >Loading...</div>');
754
			'    color: #555;" >Loading...</div>');
758
 
755
 
759
		doGetAjaxRequestHandler(context + "/dashboardModal", function (response) {
756
		doGetAjaxRequestHandler(context + "/dashboardModal", function (response) {
760
			$('#chartData').html(response);
757
			$('#chartData').html(response);
-
 
758
			$('#partnerTasks').css('zoom', '125%').modal('show');
761
		});
759
		});
762
	} else {
760
	} else {
763
		// Show some default content or empty state
-
 
764
		$('#chartData').html('<p>No data to load</p>');
761
		$('#chartData').html('<p>No data to load</p>');
-
 
762
		$('#partnerTasks').css('zoom', '125%').modal('show');
-
 
763
	}
-
 
764
}
-
 
765
 
-
 
766
$(document).ready(function () {
-
 
767
	const today = new Date().toDateString();
-
 
768
	const currentHour = new Date().getHours();
-
 
769
	const stored = JSON.parse(localStorage.getItem('modalData') || '{}');
-
 
770
 
-
 
771
	if (stored.date !== today) {
-
 
772
		localStorage.setItem('modalData', JSON.stringify({date: today, count: 1}));
-
 
773
		console.log('First login of day - showing modal');
-
 
774
		showModal();
-
 
775
	} else if (stored.count === 1 && currentHour >= 17) {
-
 
776
		localStorage.setItem('modalData', JSON.stringify({date: today, count: 2}));
-
 
777
		console.log('5 PM show - showing modal');
-
 
778
		showModal();
-
 
779
	} else {
-
 
780
		console.log('Modal conditions not met - not showing');
-
 
781
		$('#partnerTasks').modal('hide');
765
	}
782
	}
766
});
783
});
-
 
784
 
767
$(document).on('click', '.partner-tasks-btn', function () {
785
$(document).on('click', '.partner-tasks-btn', function () {
768
	doGetAjaxRequestHandler(context + "/dashboardModal", function (response) {
786
	doGetAjaxRequestHandler(context + "/dashboardModal", function (response) {
769
		$('#chartData').html(response);
787
		$('#chartData').html(response);
-
 
788
		$('#partnerTasks').css('zoom', '125%').modal('show');
770
		$('#partnerTasks').modal('show');
789
		$('#partnerTasks').modal('show');
771
	});
790
	});
772
});
791
});
773
 
792
 
774
$('#partnerTasks').on('hidden.bs.modal', function () {
793
$('#partnerTasks').on('hidden.bs.modal', function () {
Line 776... Line 795...
776
	$('.modal-backdrop').remove();
795
	$('.modal-backdrop').remove();
777
	const bootstrapCss = document.getElementById('modal-bootstrap-css');
796
	const bootstrapCss = document.getElementById('modal-bootstrap-css');
778
	if (bootstrapCss) {
797
	if (bootstrapCss) {
779
		bootstrapCss.remove();
798
		bootstrapCss.remove();
780
	}
799
	}
781
 
-
 
782
});
-
 
783
$('#partnerTasks').css('zoom', '125%').modal('show');
-
 
784
800
});
-
 
801
785
802