Skip to content

Commit

Permalink
Update: adjusted MLA vessel form to account for reissued applications
Browse files Browse the repository at this point in the history
  • Loading branch information
awf-dbca committed Jan 24, 2025
1 parent a5819a0 commit 682c7f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion mooringlicensing/components/proposals/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
InsuranceCertificateDocument,
)
from mooringlicensing.ledger_api_utils import retrieve_email_userro
from mooringlicensing.components.approvals.models import MooringLicence, MooringOnApproval, Approval
from mooringlicensing.components.approvals.models import MooringLicence, MooringOnApproval, Approval, VesselOwnershipOnApproval
from mooringlicensing.components.main.serializers import CommunicationLogEntrySerializer
from mooringlicensing.components.users.serializers import UserSerializer, ProposalApplicantSerializer
from ledger_api_client.managed_models import SystemUser
Expand Down Expand Up @@ -302,6 +302,11 @@ def get_current_vessels_rego_list(self, obj):
if obj.approval and type(obj.approval.child_obj) is MooringLicence:
vessels_str = ''
vessels_str += ', '.join([vo.vessel.rego_no for vo in obj.listed_vessels.filter(end_date__isnull=True)])

if not vessels_str and obj.approval and obj.approval.reissued:
voas = VesselOwnershipOnApproval.objects.filter(approval=obj.approval,end_date__isnull=True).distinct("vessel_ownership__vessel__rego_no")
vessels_str += ', '.join([voa.vessel_ownership.vessel.rego_no for voa in voas])

return vessels_str

def get_previous_application_preferred_bay_id(self, obj):
Expand Down Expand Up @@ -1097,6 +1102,11 @@ def get_current_vessels_rego_list(self, obj):
if obj.approval and type(obj.approval.child_obj) is MooringLicence:
vessels_str = ''
vessels_str += ', '.join([vo.vessel.rego_no for vo in obj.listed_vessels.filter(end_date__isnull=True)])

if not vessels_str and obj.approval and obj.approval.reissued:
voas = VesselOwnershipOnApproval.objects.filter(approval=obj.approval,end_date__isnull=True).distinct("vessel_ownership__vessel__rego_no")
vessels_str += ', '.join([voa.vessel_ownership.vessel.rego_no for voa in voas])

return vessels_str

def get_reissued(self, obj):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
v-model="vessel.vessel_details.vessel_name" required />
</div>
</div>
<div v-if="!readonly || vessel.vessel_ownership.individual_owner" class="row form-group">
<div v-if="!readonly || (vessel.vessel_ownership.individual_owner && vessel.vessel_ownership.owner_name)" class="row form-group">
<label for="" class="col-sm-3 control-label">Registration vessel owner *</label>
<div v-if="!readonly" class="col-sm-9">
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
},
readonlyMLA: function() {
let readonly = false;
if (this.readonly || (this.proposal.proposal_type.code === 'new')) {
if (this.readonly || (this.proposal.proposal_type.code === 'new' && !this.proposal.reissued)) {
readonly = true;
}
return readonly;
Expand Down

0 comments on commit 682c7f3

Please sign in to comment.