Skip to content

Commit

Permalink
modal migrated
Browse files Browse the repository at this point in the history
  • Loading branch information
purveshpatelau committed Jul 16, 2020
1 parent 28251e9 commit 10d2dea
Show file tree
Hide file tree
Showing 15 changed files with 398 additions and 350 deletions.
97 changes: 64 additions & 33 deletions resources/components/order/order/OrderTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,39 +43,70 @@
</div>
</template>
</avored-table>
<a-modal
title="Change Track Code"
v-model="track_code_modal_visibility"
ok-text="Save"
@cancel="handleTrackCodeCancel"
@ok="handleTrackCodeOk">
<avored-input
label-text="Tracking Code"
field-name="track_code"
:init-value="track_code"
v-model="track_code"
>
</avored-input>
</a-modal>
<a-modal
title="Order Status"
v-model="change_status_modal_visibility"
@cancel="handleChangeStatusCancel"
ok-text="Save"
@ok="handleChangeStatusOk"
>
<div class="block">
<avored-select
label-text="Order Status"
field-name="order_status_id"
:init-value="currentRecord.order_status_id"
:options="orderStatuses"
v-model="changeStatusId"
>
</avored-select>

</div>
</a-modal>

<avored-modal modal-title="Change Track Code" @close="track_code_modal_visibility=false" :is-visible="track_code_modal_visibility">
<div class="block">
<avored-input
label-text="Tracking Code"
field-name="track_code"
:init-value="track_code"
v-model="track_code"
>
</avored-input>
<div class="mt-3 py-3">
<button type="button" @click="handleTrackCodeOk"
class="px-3 py-2 text-white hover:text-white bg-red-600 rounded hover:bg-red-700"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 inline-flex w-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M0 2C0 .9.9 0 2 0h14l4 4v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm5 0v6h10V2H5zm6 1h3v4h-3V3z"/>
</svg>
<span class="ml-3">Save</span>
</button>


<button type="button" @click="handleTrackCodeCancel"
class="px-3 py-2 font-xs text-white hover:text-white bg-gray-500 hover:bg-gray-600 rounded"
>
<span class="">Cancel</span>
</button>

</div>

</div>
</avored-modal>

<avored-modal modal-title="Change Order Status" @close="change_status_modal_visibility=false" :is-visible="change_status_modal_visibility">
<div class="block">
<avored-select
label-text="Order Status"
field-name="order_status_id"
:init-value="currentRecord.order_status_id"
:options="orderStatuses"
v-model="changeStatusId"
>
</avored-select>
<div class="mt-3 py-3">
<button type="button" @click="handleChangeStatusOk"
class="px-3 py-2 text-white hover:text-white bg-red-600 rounded hover:bg-red-700"
>
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 inline-flex w-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M0 2C0 .9.9 0 2 0h14l4 4v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm5 0v6h10V2H5zm6 1h3v4h-3V3z"/>
</svg>
<span class="ml-3">Save</span>
</button>


<button type="button" @click="handleChangeStatusCancel"
class="px-3 py-2 font-xs text-white hover:text-white bg-gray-500 hover:bg-gray-600 rounded"
>
<span class="">Cancel</span>
</button>

</div>

</div>
</avored-modal>

</div>
</template>

Expand Down
80 changes: 80 additions & 0 deletions resources/js/modules/system/components/forms/AvoRedModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<template>
<Transition name="fade">
<div
v-if="isModalVisible"
class="fixed inset-0 w-full h-screen flex items-center justify-center bg-modal-700"
>
<div
class="max-h-screen w-full max-w-2xl bg-white shadow-lg rounded-lg"
>
<div class="flex items-center border-b p-3">
<div class="text-red-500 font-semibold">{{ modalTitle }}</div>

<button
v-if="displayClose"
aria-label="close"
class="text-xl text-gray-500 ml-auto"
type="button"
@click="close"
>
×
</button>
</div>

<div class="overflow-auto p-5 block max-h-screen w-full">
<slot />
</div>
</div>
</div>
</Transition>
</template>
<script>
export default {
name: "avored-modal",
props: {
isVisible: {
type: [Boolean],
default: true
},
modalTitle: {
type: [String],
default: ''
},
displayClose: {
type: [Boolean],
default: true
}
},
data() {
return {
isModalVisible: false
};
},
methods: {
close() {
this.isModalVisible = false
this.$emit('close')
}
},
watch: {
isVisible: function(newVal, oldVal) { // watch it
this.isModalVisible = newVal
}
},
mounted() {
this.isModalVisible = this.isVisible
}
};
</script>
<style>
.fade-enter-active,
.fade-leave-active {
transition: all 0.6s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
</style>
1 change: 1 addition & 0 deletions resources/js/services/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Vue.component('avored-select', require('@/modules/system/components/forms/AvoRed
Vue.component('avored-toggle', require('@/modules/system/components/forms/AvoRedToggle').default)
Vue.component('avored-tabs', require('@/modules/system/components/forms/AvoRedTabs').default)
Vue.component('avored-tab', require('@/modules/system/components/forms/AvoRedTab').default)
Vue.component('avored-modal', require('@/modules/system/components/forms/AvoRedModal').default)
Loading

0 comments on commit 10d2dea

Please sign in to comment.