Skip to content

Commit

Permalink
Merge pull request #480 from awf-dbca/js-fixes
Browse files Browse the repository at this point in the history
Minor JS fixes
  • Loading branch information
xzzy authored Oct 30, 2024
2 parents 0c5469f + 6fda6d2 commit 0c4b7ad
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,13 @@
<div class="container-fluid">
<alert :show.sync="showError" type="danger"><strong>{{ errorString }}</strong></alert>
<div class="row form-group">
<!-- <table class="table table-striped table-bordered">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Number</th>
<th scope="col">vessel</th>
<th scope="col">mooring</th>
</tr>
</thead>
<tbody>
<tr v-for="sticker in stickers" :key="sticker.id">
<td><input type="checkbox" v-model="sticker.checked" /></td>
<td>{{ sticker.number }}</td>
<td>{{ sticker.vessel.rego_no }}</td>
<td>
<span v-for="mooring in sticker.moorings">
{{ mooring.name }} ({{ mooring.mooring_bay_name }})
</span>
</td>
</tr>
</tbody>
</table> -->

<datatable
ref="swap_moorings_datatable"
:id="datatable_id"
:dtOptions="datatable_options"
:dtHeaders="datatable_headers"
/>
</div>
<!-- <div class="row form-group">
<label class="col-sm-2 control-label" for="reason">Reason</label>
<div class="col-sm-9">
<textarea class="col-sm-9 form-control" name="reason" v-model="details.reason"></textarea>
</div>
</div> -->
</div>
<div slot="footer">
<div class="row">
Expand Down Expand Up @@ -189,47 +160,15 @@ export default {
return helpers.getCookie('csrftoken')
},
datatable_options: function() {
console.log('datatable_options!!!')
let vm = this;
let selectedColumns = [];
if (vm.is_internal) {
selectedColumns = [
let selectedColumns = [
vm.columnId,
vm.columnSelect,
vm.columnLodgementNumber,
// vm.columnApprovalType,
// vm.columnStickerNumber,
// vm.columnStickerMailedDate,
// vm.columnHolder,
// vm.columnStatus,
vm.columnMooring,
// vm.columnIssueDate,
// vm.columnStartDate,
// vm.columnExpiryDate,
// vm.columnApprovalLetter,
// vm.columnStickerReplacement,
vm.columnVesselRegos,
// vm.columnGracePeriod,
// vm.columnAction,
]
}
]
let buttons = []
// if (vm.is_internal){
// buttons = [
// {
// extend: 'excel',
// exportOptions: {
// //columns: ':visible'
// }
// },
// {
// extend: 'csv',
// exportOptions: {
// //columns: ':visible'
// }
// },
// ]
// }
return {
autoWidth: false,
Expand All @@ -239,7 +178,6 @@ export default {
responsive: true,
serverSide: true,
lengthMenu: [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
//searching: false,
searching: true,
ajax: {
"url": api_endpoints.approvals_paginated_list + '/list2/?format=datatables&target_email_user_id=' + vm.target_email_user_id + '&for_swap_moorings_modal=True',
Expand All @@ -248,19 +186,10 @@ export default {
// adding extra GET params for Custom filtering
"data": function ( d ) {
// d.filter_approval_type = 'ml'
// d.show_expired_surrendered = vm.show_expired_surrendered;
//d.external_waiting_list = vm.externalWaitingList;
//d.filter_status = vm.filterStatus;
d.filter_approval_type2 = 'ml'
//d.filter_mooring_bay_id = vm.filterMooringBay;
//d.filter_holder_id = vm.filterHolder;
// d.max_vessel_length = vm.maxVesselLength;
// d.max_vessel_draft = vm.maxVesselDraft;
d.csrfmiddlewaretoken = vm.csrf_token
}
},
//dom: 'frt', //'lBfrtip',
dom: 'lBfrtip',
buttons: buttons,
columns: selectedColumns,
Expand All @@ -284,32 +213,15 @@ export default {
}
},
datatable_headers: function() {
if (this.is_internal) {
return [
'Id',
'Select',
'Number',
// 'Type',
// 'Sticker Number/s',
// 'Sticker mailed date',
// 'Holder',
// 'Status',
'Mooring',
// 'Issue Date',
// 'Start Date',
// 'Expiry Date',
// 'Approval letter',
// 'Sticker replacement',
'Vessel Rego',
// 'Grace period end date',
]
}
return [
'Id',
'Select',
'Number',
'Mooring',
'Vessel Rego',
]
},
okButtonEnabled: function(){
// if (this.selectedApprovalId){
// return true
// }
// return false
let enabled = false
if (this.approval_id && this.selectedApprovalId && this.approval_id != this.selectedApprovalId){
enabled = true
Expand Down Expand Up @@ -345,10 +257,7 @@ export default {
confirmButtonColor:'#dc3545'
}).then(()=>{
vm.$emit("sendData", {
//"details": vm.details,
"approval_id": vm.approval_id,
//"stickers": vm.stickers,
//"waive_the_fee": vm.waive_the_fee,
"target_approval_id": vm.selectedApprovalId,
})
})
Expand All @@ -364,8 +273,6 @@ export default {
this.errors = false
this.processing = false
this.approval_id = null
//$('.has-error').removeClass('has-error');
//this.validation_form.resetForm();
},
addEventListeners: function () {
let vm = this;
Expand All @@ -378,7 +285,6 @@ export default {
},
},
created:function () {
// this.fetchData()
this.$nextTick(() => {
this.addEventListeners();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,65 +1,5 @@
<template>
<div class="container" id="externalDash">
<!--
<FormSection
:formCollapse="false"
label="Applications"
subtitle="- View existing applications and lodge new ones"
Index="applications"
>
<ApplicationsTable
level="external"
/>
</FormSection>
<FormSection
:formCollapse="false"
label="Waiting List"
subtitle="- View and amend your waiting list allocation"
Index="waiting_list"
>
<WaitingListTable
level="external"
:approvalTypeFilter="wlaApprovalTypeFilter"
/>
</FormSection>
<FormSection
:formCollapse="false"
label="Licences and Permits"
subtitle="- View existing licences / permits and renew them"
Index="licences_and_permits"
>
<LicencesAndPermitsTable
level="external"
:approvalTypeFilter="allApprovalTypeFilter"
/>
</FormSection>
<FormSection
:formCollapse="false"
label="Compliances"
subtitle="- View submitted Compliances and submit new ones"
Index="compliances"
>
<CompliancesTable
level="external"
/>
</FormSection>
<FormSection
:formCollapse="false"
label="Authorised User Applications for my Endorsement"
subtitle=""
Index="authorised_user_applications_for_my_endorsement"
>
<AuthorisedUserApplicationsTable
level="external"
/>
</FormSection>
-->

<!-- <span @click="recalc">test</span> -->
<template v-for="component in components_ordered">
<FormSection
:formCollapse="component.formCollapse"
Expand All @@ -79,12 +19,9 @@
</template>

<script>
import datatable from '@/utils/vue/datatable.vue'
import FormSection from "@/components/forms/section_toggle.vue"
import ApplicationsTable from "@/components/common/table_proposals"
//import WaitingListTable from "@/components/common/table_approval_waiting_list"
import WaitingListTable from "@/components/common/table_approvals"
//import LicencesAndPermitsTable from "@/components/common/table_approval_licences_and_permits"
import LicencesAndPermitsTable from "@/components/common/table_approvals"
import CompliancesTable from "@/components/common/table_compliances"
import AuthorisedUserApplicationsTable from "@/components/common/table_approval_to_be_endorsed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
:uuid="arrival.uuid"
:arrival="arrival"
@delete_arrival="delete_arrival"
:key="arrival.uuid"
:dcv_vessel="dcv_admission.dcv_vessel"
:fee_configurations="fee_configurations"
:column_approved_events_shown=false
Expand Down Expand Up @@ -140,7 +139,7 @@ import datatable from '@/utils/vue/datatable.vue'
import FormSection from "@/components/forms/section_toggle.vue"
import PanelArrival from "@/components/common/panel_dcv_admission_arrival.vue"
import { api_endpoints, helpers } from '@/utils/hooks'
import uuid from 'uuid'
import { v4 as uuidv4 } from 'uuid';
var select2 = require('select2');
require("select2/dist/css/select2.min.css");
Expand Down Expand Up @@ -184,7 +183,7 @@ export default {
contact_number: '',
arrivals: [
{
uuid: uuid(),
uuid: uuidv4(),
arrival_date: null,
private_visit: false,
adults: {
Expand Down Expand Up @@ -586,7 +585,7 @@ export default {
add_another_date_clicked: function() {
this.dcv_admission.arrivals.push(
{
uuid: uuid(),
uuid: uuidv4(),
arrival_date: null,
private_visit: false,
adults: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ export default
component: DcvAdmission,
name:'dcv_admission'
},
{
path: 'dcv_admission_form',
component: DcvAdmissionForm,
name:'dcv-admission-form'
}
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</template>

<script>
import uuid from 'uuid';
import { v4 as uuidv4 } from 'uuid';
export default {
name:"FormSection",
Expand All @@ -40,7 +40,7 @@ export default {
return {
title:"Section title",
panel_chevron_class: null,
custom_id: uuid(),
custom_id: uuidv4(),
}
},
computed:{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import {
}
from '@/utils/hooks'
import FormSection from "@/components/forms/section_toggle.vue"
import uuid from 'uuid'
import { v4 as uuidv4 } from 'uuid';
import { constants } from '@/utils/hooks'
export default {
Expand Down Expand Up @@ -198,15 +198,6 @@ export default {
}
return display
},
/*
approvalStartDate: function() {
let returnDate = null;
if (this.proposal && this.proposal.approval) {
returnDate = moment(this.proposal.approval.start_date, 'YYYY-MM-DD').format('DD/MM/YYYY');
}
return returnDate;
},
*/
approvalExpiryDate: function() {
let returnDate = null;
if (this.proposal && this.proposal.end_date) {
Expand Down Expand Up @@ -244,7 +235,7 @@ export default {
},
updateComponentSiteSelectionKey: function(){
console.log('in updateComponentSiteSelectionKey')
this.component_site_selection_key = uuid()
this.component_site_selection_key = uuidv4()
},
},
mounted: function(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ import FormSection from "@/components/forms/section_toggle.vue"
import StickersTable from "@/components/common/table_stickers.vue"
import ModalDetails from "@/components/common/sticker_replacement_modal.vue"
import { api_endpoints, helpers } from '@/utils/hooks'
import uuid from 'uuid'
import { v4 as uuidv4 } from 'uuid';
export default {
name: 'InternalStickersDashboard',
data() {
let vm = this;
return {
uuid: uuid()
uuid: uuidv4()
}
},
components:{
Expand Down

0 comments on commit 0c4b7ad

Please sign in to comment.