Skip to content

Commit

Permalink
FamilyView js clean up (ChurchCRM#2104)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adnan0703 authored and DawoudIO committed Mar 14, 2017
1 parent d117ae6 commit df6c391
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/FamilyView.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@

$bOkToEdit = ($_SESSION['bEditRecords'] || ($_SESSION['bEditSelf'] && ($iFamilyID == $_SESSION['iFamID']))); ?>
<script>
var familyId = <?= $fam_ID ?>;
window.CRM.currentFamily = <?= $iFamilyID ?>;
</script>

<?php if (!empty($fam_DateDeactivated)) {
Expand Down Expand Up @@ -1005,7 +1005,6 @@ class="btn btn-success"><i class="fa fa-check"></i> <?= gettext("Verified In Per
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/FamilyView.js" type="text/javascript"></script>
<script src="<?= SystemURLs::getRootPath() ?>/skin/js/MemberView.js" type="text/javascript"></script>
<script>
window.CRM.currentFamily = <?= $iFamilyID ?>;
window.CRM.currentActive = <?= (empty($fam_DateDeactivated) ? 'true' : 'false') ?>;
var dataT = 0;
$(document).ready(function() {
Expand Down Expand Up @@ -1043,7 +1042,7 @@ class="btn btn-success"><i class="fa fa-check"></i> <?= gettext("Verified In Per
$("#deletePhoto").click (function () {
$.ajax({
type: "POST",
url: window.CRM.root + "/api/families/<?= $iFamilyID ?>/photo",
url: window.CRM.root + "/api/families/" + window.CRM.currentFamily + "/photo",
encode: true,
dataType: 'json',
data: {
Expand All @@ -1055,7 +1054,7 @@ class="btn btn-success"><i class="fa fa-check"></i> <?= gettext("Verified In Per
});

window.CRM.photoUploader = $("#photoUploader").PhotoUploader({
url: window.CRM.root + "/api/families/" + familyId + "/photo",
url: window.CRM.root + "/api/families/" + window.CRM.currentFamily + "/photo",
maxPhotoSize: window.CRM.maxUploadSize,
photoHeight: 400,
photoWidth: 400,
Expand All @@ -1065,14 +1064,14 @@ class="btn btn-success"><i class="fa fa-check"></i> <?= gettext("Verified In Per
});


contentExists(window.CRM.root + "/api/families/" + familyId + "/photo", function(success) {
contentExists(window.CRM.root + "/api/families/" + window.CRM.currentFamily + "/photo", function(success) {
if (success) {
$("#view-larger-image-btn").removeClass('hide');

$("#view-larger-image-btn").click(function() {
bootbox.alert({
title: "<?= gettext('Family Photo') ?>",
message: '<img class="img-rounded img-responsive center-block" src="<?= SystemURLs::getRootPath() ?>/api/families/' + familyId + '/photo" />',
message: '<img class="img-rounded img-responsive center-block" src="<?= SystemURLs::getRootPath() ?>/api/families/' + window.CRM.currentFamily + '/photo" />',
backdrop: true
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/skin/js/FamilyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $(document).ready(function () {
$("#onlineVerify").click(function () {
$.ajax({
type: 'POST',
url: window.CRM.root + '/api/families/' + familyId + "/verify"
url: window.CRM.root + '/api/families/' + window.CRM.currentFamily + '/verify'
})
.done(function(data, textStatus, xhr) {
$('#confirm-verify').modal('hide');
Expand All @@ -18,7 +18,7 @@ $(document).ready(function () {
$("#verifyNow").click(function () {
$.ajax({
type: 'POST',
url: window.CRM.root + '/api/families/verify/' + familyId + "/now"
url: window.CRM.root + '/api/families/verify/' + window.CRM.currentFamily + '/now'
})
.done(function(data, textStatus, xhr) {
$('#confirm-verify').modal('hide');
Expand All @@ -32,7 +32,7 @@ $(document).ready(function () {


$("#verifyDownloadPDF").click(function () {
window.open(window.CRM.root + 'Reports/ConfirmReport.php?familyId=' + familyId, '_blank');
window.open(window.CRM.root + 'Reports/ConfirmReport.php?familyId=' + window.CRM.currentFamily, '_blank');
$('#confirm-verify').modal('hide');
});
});

0 comments on commit df6c391

Please sign in to comment.