81 lines
2.6 KiB
CoffeeScript
81 lines
2.6 KiB
CoffeeScript
|
$ ->
|
||
|
elem = $("#chars")
|
||
|
$("#id_phone_number").mask "(999) 999-9999"
|
||
|
$("#id_alternate_phone").mask "(999) 999-9999"
|
||
|
$("#id_fax_number").mask "(999) 999-9999"
|
||
|
$("#set_all").click all_days_same
|
||
|
$("#set_MF").click all_MF
|
||
|
$("#set_clear").click clear_times
|
||
|
$.each [
|
||
|
"sunday"
|
||
|
"monday"
|
||
|
"tuesday"
|
||
|
"wednesday"
|
||
|
"thursday"
|
||
|
"friday"
|
||
|
"saturday"
|
||
|
], (i, day) ->
|
||
|
$("#id_hours_" + day + "_close").insertAfter "#id_hours_" + day + "_open"
|
||
|
|
||
|
|
||
|
$("#id_hours_sunday_close").after " <a href='#' id='set_all'>[Apply To All]</a>"
|
||
|
$("#id_hours_monday_close").after " <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
|
||
|
$("#how").click ->
|
||
|
$(".how").toggle()
|
||
|
|
||
|
|
||
|
$("#id_localeze_categories").select2 maximumSelectionSize: 3
|
||
|
$("#id_payment_types_commadelimited_0").click clear_payment_types
|
||
|
$("#id_payment_types_commadelimited_1").click check_payment_types
|
||
|
$("#id_payment_types_commadelimited_2").click check_payment_types
|
||
|
$("#id_payment_types_commadelimited_3").click check_payment_types
|
||
|
$("#id_payment_types_commadelimited_4").click check_payment_types
|
||
|
$("#id_payment_types_commadelimited_5").click check_payment_types
|
||
|
$("#id_payment_types_commadelimited_6").click check_payment_types
|
||
|
$("#id_payment_types_commadelimited_7").click check_payment_types
|
||
|
$("#id_payment_types_commadelimited_8").click check_payment_types
|
||
|
$("#id_payment_types_commadelimited_9").click check_payment_types
|
||
|
$("#id_open247").click open247
|
||
|
|
||
|
clear_payment_types = ->
|
||
|
unchecked = true
|
||
|
i = 1
|
||
|
|
||
|
while i <= 9
|
||
|
$("#id_payment_types_commadelimited_" + i).prop "checked", ""
|
||
|
i++
|
||
|
|
||
|
check_payment_types = ->
|
||
|
unchecked = true
|
||
|
i = 1
|
||
|
|
||
|
while i <= 9
|
||
|
if $("#id_payment_types_commadelimited_" + i).is(":checked")
|
||
|
$("#id_payment_types_commadelimited_0").prop "checked", ""
|
||
|
unchecked = false
|
||
|
i++
|
||
|
$("#id_payment_types_commadelimited_0").prop "checked", "checked" if unchecked
|
||
|
|
||
|
all_days_same = ->
|
||
|
open_time = $("#id_hours_sunday_open").val()
|
||
|
close_time = $("#id_hours_sunday_close").val()
|
||
|
$("select[id*=day_open]").val open_time
|
||
|
$("select[id*=day_close]").val close_time
|
||
|
false
|
||
|
|
||
|
all_MF = ->
|
||
|
open_time = $("#id_hours_monday_open").val()
|
||
|
close_time = $("#id_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
|
||
|
$("select[id*=day_close]").val close_time
|