Supplier section management improvements
This commit is contained in:
@@ -3,10 +3,4 @@ Qsupplier.App.DropdownLink = Ember.Component.extend
|
|||||||
active: false
|
active: false
|
||||||
classNames: ['dropdown-container']
|
classNames: ['dropdown-container']
|
||||||
classNameBindings: ['active']
|
classNameBindings: ['active']
|
||||||
didInsertElement: ->
|
click: -> @set 'active', !@get('active')
|
||||||
@$('.dropdown-trigger').click (e)=>
|
|
||||||
e.preventDefault()
|
|
||||||
@set 'active', !@get('active')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
Qsupplier.App.ModalDialogComponent = Ember.Component.extend
|
||||||
|
actions:
|
||||||
|
close: ->
|
||||||
|
@sendAction()
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Qsupplier.App.ModalConfirmController = Ember.ObjectController.extend
|
||||||
|
actions:
|
||||||
|
close: ->
|
||||||
|
@get('model.cancel').call(@) if @get('model.cancel')
|
||||||
|
@send 'closeModal'
|
||||||
|
confirm: ->
|
||||||
|
@get('model.ok').call(@)
|
||||||
|
@send 'closeModal'
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
Qsupplier.App.ModalController = Ember.ObjectController.extend
|
||||||
|
actions:
|
||||||
|
close: ->
|
||||||
|
@send 'closeModal'
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
Qsupplier.App.ModalInfoController = Ember.ObjectController.extend
|
||||||
|
actions:
|
||||||
|
close: ->
|
||||||
|
@get('model.cancel').call(@) if @get('model.cancel')
|
||||||
|
@send 'closeModal'
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
Qsupplier.App.ModalSectionAddTablesController = Ember.ObjectController.extend
|
||||||
|
number_start: 100
|
||||||
|
number_end: 110
|
||||||
|
actions:
|
||||||
|
close: ->
|
||||||
|
@get('model.cancel').call(@) if @get('model.cancel')
|
||||||
|
@send 'closeModal'
|
||||||
|
confirm: ->
|
||||||
|
@get('model.ok').call(@)
|
||||||
|
@send 'closeModal'
|
||||||
|
addTables: ->
|
||||||
|
s = parseInt(@get('number_start'))
|
||||||
|
e = parseInt(@get('number_end'))
|
||||||
|
if e < s
|
||||||
|
@set 'number_start', e
|
||||||
|
@set 'number_end', s
|
||||||
|
s = @get('number_start')
|
||||||
|
e = @get('number_end')
|
||||||
|
|
||||||
|
Ember.$.post Routes.add_tables_suppliers_section_path(@get('model.id')),
|
||||||
|
number_start: s
|
||||||
|
number_end: e
|
||||||
|
, (result,state,xhr)=>
|
||||||
|
@store.pushPayload 'table', result
|
||||||
|
@send 'close'
|
||||||
@@ -9,8 +9,8 @@ Qsupplier.App.SectionController = Ember.ObjectController.extend
|
|||||||
@set('editmode', false)
|
@set('editmode', false)
|
||||||
@get('model').save()
|
@get('model').save()
|
||||||
addTables: ->
|
addTables: ->
|
||||||
debugger
|
#$('#add-tables-modal').modal()
|
||||||
$('#add-tables-modal').modal()
|
@send 'openModal', 'modal_section_add_tables', @get('model')
|
||||||
arrangeTables: ->
|
arrangeTables: ->
|
||||||
$('#arrange-tables-modal').modal()
|
$('#arrange-tables-modal').modal()
|
||||||
textures: ['wood1', 'wood2']
|
textures: ['wood1', 'wood2']
|
||||||
|
|||||||
@@ -6,3 +6,19 @@ Qsupplier.App.ApplicationRoute = Ember.Route.extend
|
|||||||
setupController: (controller)->
|
setupController: (controller)->
|
||||||
@store.find 'list', state: 'active'
|
@store.find 'list', state: 'active'
|
||||||
controller.set 'product_categories', @store.all('product_category')
|
controller.set 'product_categories', @store.all('product_category')
|
||||||
|
actions:
|
||||||
|
openModal: (modalName, model)->
|
||||||
|
@controllerFor(modalName).set('model', model)
|
||||||
|
@render modalName,
|
||||||
|
into: 'application'
|
||||||
|
outlet: 'modal'
|
||||||
|
closeModal: ->
|
||||||
|
@disconnectOutlet
|
||||||
|
outlet: 'modal'
|
||||||
|
parentView: 'application'
|
||||||
|
confirm: (options = {})->
|
||||||
|
@send 'openModal', 'modal_confirm', Ember.Object.create
|
||||||
|
title: options.title
|
||||||
|
body: options.body
|
||||||
|
cancel: options.cancel
|
||||||
|
ok: options.ok
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
= outlet
|
||||||
|
= outlet modal
|
||||||
@@ -1 +0,0 @@
|
|||||||
{{outlet}}
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
.overlay{action "close"}
|
||||||
|
.modal{action bubbles=false preventDefault=false}= yield
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
modal-dialog action="close"
|
||||||
|
h3.flush--top Alert
|
||||||
|
p= body
|
||||||
|
button{action "close"} Done
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
modal-dialog action="close"
|
||||||
|
h3.flush--top= title
|
||||||
|
p=body
|
||||||
|
hr
|
||||||
|
button.confirm-cancel{action "close"}= t 'confirm.cancel'
|
||||||
|
button.confirm-ok.right{action 'confirm'}= t 'confirm.confirm'
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
modal-dialog action="close"
|
||||||
|
h3.flush--top= title
|
||||||
|
p==body
|
||||||
|
hr
|
||||||
|
button{action 'close'}= t 'modal.info.close'
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
modal-dialog action="close"
|
||||||
|
.modal-header
|
||||||
|
h3.flush--top=t 'section.add_tables.modal.title'
|
||||||
|
hr
|
||||||
|
.modal-body
|
||||||
|
p=t 'section.add_tables.modal.body_header'
|
||||||
|
form.form-horizontal
|
||||||
|
.control-group
|
||||||
|
.form-row
|
||||||
|
.form-label
|
||||||
|
label for='add-tables-number-start'
|
||||||
|
=t 'section.add_tables.modal.number_start'
|
||||||
|
.form-field
|
||||||
|
Qsupplier.App.NumberField valueBinding="number_start"
|
||||||
|
.form-row
|
||||||
|
.form-label
|
||||||
|
label for='add-tables-number-end'
|
||||||
|
=t 'section.add_tables.modal.number_end'
|
||||||
|
.form-field
|
||||||
|
Qsupplier.App.NumberField valueBinding="number_end"
|
||||||
|
.modal-footer
|
||||||
|
hr
|
||||||
|
button.confirm-cancel{action "close"}=t 'section.add_tables.modal.close_button'
|
||||||
|
button.confirm-ok.right{action "addTables"}=t 'section.add_tables.modal.add_button'
|
||||||
@@ -19,13 +19,21 @@
|
|||||||
Qsupplier.App.DropdownLink title="Action"
|
Qsupplier.App.DropdownLink title="Action"
|
||||||
ul
|
ul
|
||||||
li
|
li
|
||||||
a{action addTables} {{t 'section.add_tables.button_label'}}
|
a{action addTables}
|
||||||
|
span.section-add-tables-icon
|
||||||
|
=t 'section.add_tables.button_label'
|
||||||
li
|
li
|
||||||
a{action arrangeTables} {{t 'section.arrange_tables.modal.title'}}
|
a{action arrangeTables}
|
||||||
|
span.section-arrange-tables-icon
|
||||||
|
=t 'section.arrange_tables.modal.title'
|
||||||
li
|
li
|
||||||
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}" {{t 'tables.qr_codes.link'}}
|
a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}"
|
||||||
|
span.table-qr-codes
|
||||||
|
=t 'tables.qr_codes.link'
|
||||||
li
|
li
|
||||||
a href="{{route 'suppliers_section_path' id}}" data-method="delete" data-confirm="{{t 'helpers.links.are_you_sure' bare=true}}" {{t 'helpers.links.destroy'}}
|
a.section-destroy href="{{route 'suppliers_section_path' id}}" data-method="delete" data-confirm="{{t 'helpers.links.are_you_sure' bare=true}}"
|
||||||
|
span.section-remove-icon
|
||||||
|
=t 'helpers.links.destroy'
|
||||||
Ember.TextField valueBinding="title" class="section-edit-title-field"
|
Ember.TextField valueBinding="title" class="section-edit-title-field"
|
||||||
Qsupplier.App.NumberField valueBinding="width" class="dimension section-edit-width-field"
|
Qsupplier.App.NumberField valueBinding="width" class="dimension section-edit-width-field"
|
||||||
span.fa.fa-lg.fa-times
|
span.fa.fa-lg.fa-times
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Qsupplier.App.SectionTableView = Ember.View.extend DragNDrop.Draggable,
|
|||||||
#@$('.table-actions .title').remove()
|
#@$('.table-actions .title').remove()
|
||||||
content.hide()
|
content.hide()
|
||||||
@$el.on 'click', =>
|
@$el.on 'click', =>
|
||||||
content.toggle() if @$el.hasClass('occupied')
|
content.toggle() if @$el.hasClass('occupied') and not @get('controller.editmode')
|
||||||
#@$el.qtip
|
#@$el.qtip
|
||||||
#content:
|
#content:
|
||||||
#text: content
|
#text: content
|
||||||
|
|||||||
@@ -34,13 +34,6 @@
|
|||||||
border-bottom-color: white
|
border-bottom-color: white
|
||||||
bottom: 100%
|
bottom: 100%
|
||||||
right: 30px
|
right: 30px
|
||||||
|
|
||||||
|
|
||||||
ul
|
|
||||||
list-style: none
|
|
||||||
//&:hover
|
|
||||||
//.dropdown-list-container
|
|
||||||
//display: block
|
|
||||||
&.active
|
&.active
|
||||||
.dropdown-list-container
|
.dropdown-list-container
|
||||||
display: block
|
display: block
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.modal
|
||||||
|
margin: 10px auto
|
||||||
|
width: 300px
|
||||||
|
background-color: #fff
|
||||||
|
padding: 1em
|
||||||
|
|
||||||
|
.overlay
|
||||||
|
height: 100%
|
||||||
|
width: 100%
|
||||||
|
position: fixed
|
||||||
|
top: 0
|
||||||
|
left: 0
|
||||||
|
background-color: rgba(0, 0, 0, 0.2)
|
||||||
|
|
||||||
|
.flush--top
|
||||||
|
margin-top: 0
|
||||||
@@ -1,9 +1,16 @@
|
|||||||
.section-edit-mode-button
|
.section-edit-mode-button
|
||||||
|
+button
|
||||||
|
margin: 0
|
||||||
|
padding: 2px
|
||||||
span
|
span
|
||||||
@extend .fa
|
@extend .fa
|
||||||
@extend .fa-lg
|
@extend .fa-lg
|
||||||
@extend .fa-edit
|
@extend .fa-edit
|
||||||
.section-normal-mode-button
|
.section-normal-mode-button
|
||||||
|
+button
|
||||||
|
margin: 0
|
||||||
|
padding: 2px
|
||||||
|
margin-left: 8px
|
||||||
span
|
span
|
||||||
@extend .fa
|
@extend .fa
|
||||||
@extend .fa-lg
|
@extend .fa-lg
|
||||||
@@ -14,6 +21,35 @@
|
|||||||
.section-manage-tables
|
.section-manage-tables
|
||||||
.dropdown-container
|
.dropdown-container
|
||||||
margin-right: 10px
|
margin-right: 10px
|
||||||
|
$icon-right-margin: 8px
|
||||||
|
ul
|
||||||
|
list-style: none
|
||||||
|
margin: 0
|
||||||
|
padding: 0
|
||||||
|
li
|
||||||
|
border-bottom: 1px solid #bbb
|
||||||
|
a
|
||||||
|
font-size: 0.8em
|
||||||
|
display: block
|
||||||
|
padding: 4px 7px
|
||||||
|
&:hover
|
||||||
|
background-color: #ddd
|
||||||
|
span.table-qr-codes
|
||||||
|
margin-right: $icon-right-margin
|
||||||
|
.section-destroy
|
||||||
|
color: $alert-color
|
||||||
|
span.section-add-tables-icon
|
||||||
|
@extend .fa
|
||||||
|
@extend .fa-plus-square
|
||||||
|
margin-right: $icon-right-margin
|
||||||
|
span.section-arrange-tables-icon
|
||||||
|
@extend .fa
|
||||||
|
@extend .fa-th
|
||||||
|
margin-right: $icon-right-margin
|
||||||
|
span.section-remove-icon
|
||||||
|
@extend .fa
|
||||||
|
@extend .fa-trash-o
|
||||||
|
margin-right: $icon-right-margin
|
||||||
input
|
input
|
||||||
height: auto
|
height: auto
|
||||||
padding-top: 4px
|
padding-top: 4px
|
||||||
|
|||||||
@@ -18,12 +18,15 @@ table
|
|||||||
span
|
span
|
||||||
@extend .fa
|
@extend .fa
|
||||||
@extend .fa-pencil
|
@extend .fa-pencil
|
||||||
.table-qr-codes
|
a.table-qr-codes
|
||||||
+button($bg: $secondary-color)
|
+button($bg: $secondary-color)
|
||||||
+button-icon-only
|
+button-icon-only
|
||||||
span
|
span
|
||||||
@extend .fa
|
@extend .fa
|
||||||
@extend .fa-qrcode
|
@extend .fa-qrcode
|
||||||
|
span.table-qr-codes
|
||||||
|
@extend .fa
|
||||||
|
@extend .fa-qrcode
|
||||||
.table-destroy
|
.table-destroy
|
||||||
+button($bg: $secondary-color)
|
+button($bg: $secondary-color)
|
||||||
+button-icon-only
|
+button-icon-only
|
||||||
|
|||||||
@@ -17,4 +17,5 @@
|
|||||||
@import ./qtables
|
@import ./qtables
|
||||||
@import ./section_tab_headers
|
@import ./section_tab_headers
|
||||||
@import ./qlists
|
@import ./qlists
|
||||||
|
@import ./qmodal
|
||||||
@import ./ember_dropdown
|
@import ./ember_dropdown
|
||||||
|
|||||||
@@ -132,10 +132,10 @@ module Suppliers
|
|||||||
table = Table.new(number: table_number)
|
table = Table.new(number: table_number)
|
||||||
table.supplier = current_supplier
|
table.supplier = current_supplier
|
||||||
table.section = @section
|
table.section = @section
|
||||||
table.save
|
|
||||||
end
|
end
|
||||||
@section.arrange_tables_in_grid
|
@section.arrange_tables_in_grid
|
||||||
render json: {ok: true}
|
table_json = ActiveModel::ArraySerializer.new(@section.tables, each_serializer: SupplierTableSerializer, root: false).as_json
|
||||||
|
render json: {tables: table_json}
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /sections/1/arrange_tables {number_start: 1423, number_end: 234234}
|
# POST /sections/1/arrange_tables {number_start: 1423, number_end: 234234}
|
||||||
|
|||||||
Reference in New Issue
Block a user