listpush/app/assets/javascripts/list_entry.js.coffee

66 lines
2.0 KiB
CoffeeScript
Raw Normal View History

2014-02-13 05:47:27 +00:00
$ ->
2014-02-13 19:19:41 +00:00
$("#list_entry_localeze_categories").chosen max_selected_options: 3, placeholder_text_multiple: "Select up to Three"
2014-02-13 17:12:02 +00:00
$("#how").click ->
$(".how").toggle()
2014-02-13 05:47:27 +00:00
elem = $("#chars")
2014-02-13 17:12:02 +00:00
2014-02-13 05:47:27 +00:00
$("#set_all").click all_days_same
$("#set_MF").click all_MF
$("#set_clear").click clear_times
$.each [
2014-02-13 16:02:57 +00:00
"sun"
"mon"
"tues"
"wednes"
"thurs"
"fri"
"satur"
2014-02-13 05:47:27 +00:00
], (i, day) ->
2014-02-13 16:02:57 +00:00
$("#hours_#{day}day_close").insertAfter "#hours_#{day}_open"
2014-02-13 05:47:27 +00:00
$("#hours_sunday_close").after "&nbsp;&nbsp; <a href='#' id='set_all'>[Apply To All]</a>"
$("#hours_monday_close").after "&nbsp;&nbsp; <a href='#' id='set_MF'>[Set Monday-Friday]</a>"
$("#set_all").click all_days_same
$("#set_MF").click all_MF
$("#set_clear").click clear_times
2014-02-13 16:02:57 +00:00
for i in [0..9]
$("#payment_types_commadelimited_#{i}").click clear_payment_types
2014-02-13 17:12:02 +00:00
$("#list_entry_Phone").mask "(999) 999-9999"
2014-02-13 19:19:41 +00:00
$("#list_entry_AltNumber").mask "(999) 999-9999"
$("#list_entry_Fax").mask "(999) 999-9999"
2014-02-13 05:47:27 +00:00
clear_payment_types = ->
unchecked = true
2014-02-13 16:02:57 +00:00
for i in [1...9]
$("#payment_types_commadelimited_#{i}").prop "checked", ""
2014-02-13 05:47:27 +00:00
return
check_payment_types = ->
unchecked = true
2014-02-13 16:02:57 +00:00
for i in [1...9]
if $("#payment_types_commadelimited_#{i}").is(":checked")
2014-02-13 05:47:27 +00:00
$("#payment_types_commadelimited_0").prop "checked", ""
unchecked = false
$("#payment_types_commadelimited_0").prop "checked", "checked" if unchecked
all_days_same = ->
open_time = $("#hours_sunday_open").val()
close_time = $("#hours_sunday_close").val()
$("select[id*=day_open]").val open_time
$("select[id*=day_close]").val close_time
false
all_MF = ->
open_time = $("#hours_monday_open").val()
close_time = $("#hours_monday_close").val()
$("select[id*=day_open]:not(select[id*=sunday]):not(select[id*=saturday])").val open_time
$("select[id*=day_close]:not(select[id*=sunday]):not(select[id*=saturday])").val close_time
false
clear_times = ->
open_time = ""
close_time = ""
$("select[id*=day_open]").val open_time
2014-02-13 16:02:57 +00:00
$("select[id*=day_close]").val close_time