From f1d82e715e28483d6bb650445c2ede867b8ce22b Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Wed, 16 Jun 2010 12:01:42 +0100 Subject: [PATCH] Added filter by payment size to payments to suppliers view --- app.rb | 13 ++++- public/od_80x15_blue.png | Bin 446 -> 0 bytes public/spinner.gif | Bin 0 -> 1849 bytes public/style.css | 32 ++++++++++- views/layout.haml | 1 + views/servicepayments.haml | 93 ++++++++++++++++++------------- views/servicepaymentsdetail.haml | 24 ++++++++ 7 files changed, 120 insertions(+), 43 deletions(-) delete mode 100644 public/od_80x15_blue.png create mode 100644 public/spinner.gif create mode 100644 views/servicepaymentsdetail.haml diff --git a/app.rb b/app.rb index ca2c6c7..6b78df5 100644 --- a/app.rb +++ b/app.rb @@ -100,10 +100,21 @@ end get '/services/:slug/payments' do @service = Service.first(:slug => params[:slug]) - @total = @service.payments.sum(:amount) + @payments = Payment.all(:service => @service, :amount.gte => 0, :order => 'd') + @total = @payments.sum(:amount) haml :servicepayments end +get '/services/:slug/paymentsdetail' do + @service = Service.first(:slug => params[:slug]) + min = 500 + if params[:min].to_i > 0 + min = params[:min].to_i + end + @payments = Payment.all(:service => @service, :amount.gte => min, :order => 'd') + @total = @payments.sum(:amount) + haml :servicepaymentsdetail, :layout => false +end get '/services/?' do diff --git a/public/od_80x15_blue.png b/public/od_80x15_blue.png deleted file mode 100644 index 6314d594007363e3ff8d2f8e2c2f288bef6fdb8c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 446 zcmV;v0YUzWP)| zQsy-Lnl?ZfhPvyxNgT&11k{D?COXqA5&ISZhUPkMo<=}LYFoH$tNXR#1 zDDo_X069zvCS43e0Ef@}blL`QlP&;@<(kLw`_B6^Us*%DB?w+j0G6wahtYhyHu6k_ z5LY`M4jgE^39)Yx`_@4b$KsJ!#6?9PIZVm2(+B)wxyE)Ap1coU$M-uqZ8zE01+ZG@ z^qs;md&lv#CjcG$+_NONIS>ms)!X&JyrgaaG}} z%%esI znR7n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G!>l{9_AvsafGtVRnQr)xR?bImN4qo-#?gP`}S)0UYaWY9t`6HQwY4B_($TWNu`l?!*nIBy_|7=pQc9cnFU zs%%oO^oje|8ddh7^1-E9_|T~KBxydL{KcW06CqFQ?Ym3~cb^|wPx?lUyCBD|_nRZU zsA}@ctKd0_^(q#G?{G;+$w=8-md|N>W6e5@3AT19SLRCCSyG z=oV%uMus5!Ry9PhrZMnpmb0lXJuACSOl2|krLXzwsrVsNe(8N);u`z?E#W-RKNi9E z;z;dGgCSKfqEhya^?xWt|DBmvWexQ%SfTtu(C0Mdv9@(g3WttPh3GsE1Niv~Ituk; zXltbvX7Jn^Z4>QMtd0~JELrW+CaT^$N~khm@~tceYLLGjk=3uK@XnOQ1!btG^Pus9 zYDnDM@%;wTR-(h+ec@l>g6c`Cs7=j$FkqTfajDLuzmAAh_qHK0!$~G+eL?P46^V2( gTVr?dnQ{(H{Ie1a9NS3OKPMyDfF?Qc5iPGj047fkWdHyG literal 0 HcmV?d00001 diff --git a/public/style.css b/public/style.css index 06d9169..87e1d0f 100644 --- a/public/style.css +++ b/public/style.css @@ -10,7 +10,6 @@ body p { font-size: 110%; - margin: 30px 0; } input @@ -94,7 +93,7 @@ strong table { border-collapse: collapse; - margin-bottom: 30px 0; + margin-bottom: 50px; } td, th @@ -144,4 +143,33 @@ tr padding: 0px; font-size: 150%; line-height: 1.5em; +} + +.spinner +{ + display: none; +} + +.filter li +{ + display: inline; +} + +.filter a, .filter a:visited +{ + margin: 0 0px 0 0; + padding: 5px 10px; + background-color: #333; + color: #fff; +} + +.filter a:hover +{ + +} + +a.filter_selected +{ + background-color: red; + color: #fff; } \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index 29cfe25..5866fc8 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -7,6 +7,7 @@ %link{ :rel => 'stylesheet', :type => 'text/css', :href => '/breadcrumb/breadcrumb.css' } %link{ :rel => 'stylesheet', :type => 'text/css', :href => '/print.css', :media => 'print' } %link{ :rel => 'stylesheet', :type => 'text/css', :href => '/grid.css' } + %script{:type => 'text/javascript', :src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'} - -Comments powered by Disqus - - \ No newline at end of file +-# +
+ = haml_partial "comment_header" +
+ + + Comments powered by Disqus +
diff --git a/views/servicepaymentsdetail.haml b/views/servicepaymentsdetail.haml new file mode 100644 index 0000000..396afe2 --- /dev/null +++ b/views/servicepaymentsdetail.haml @@ -0,0 +1,24 @@ +%table + %tr + %th Date + %th Ref. + %th Supplier + %th.right £ + + - for payment in @payments + %tr + %td= payment.d.strftime("%d %b %Y") + %td.right + %a{ :href => "/payments/#{payment.id}" } + = payment.id + %td + %a{ :href => '/suppliers/' + payment.supplier.slug } + = payment.supplier.name + %td.right= commify(sprintf("%0d", payment.amount)) + + %tr + %td + %td + %td + %strong TOTAL + %td.right= commify(sprintf("%0d", @total)) \ No newline at end of file