Advertisement
charlie-bin

Controller and View Chunks

Mar 22nd, 2019
2,616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 2.94 KB | None | 0 0
  1. # Controller
  2. class PurchaseOrdersController < ApplicationController
  3.     ....
  4.  
  5.     def modify
  6.         @pr = PurchaseRequest.find(params[:prid])
  7.         @po = @pr.purchase_orders.first
  8.  
  9.         respond_to :html
  10.     end
  11.  
  12. # View
  13. .row
  14.   == render '/partials/nav_pr'
  15.  
  16.   .col-md-8 ng-controller="PurchaseOrderEditCtrl"
  17.     .row
  18.       .col-md-12
  19.         .card
  20.           .card-body
  21.             h5.card-title.text-secondary
  22.               i.fas.fa-feather-alt.text-warning&nbsp;
  23.               | PR No. #{ @pr.pr_number }
  24.               span.text-warning
  25.                 | &nbsp;/&nbsp;
  26.               | Purchase Orders
  27.  
  28.             hr.bg-light.mb-5
  29.  
  30.             form
  31.               .form-group.row
  32.                 label.col-sm-3.col-form-label
  33.                   | Mode of Proc.
  34.                 .col-sm-5
  35.                   select.custom-select.mr-sm-2 ng-init="po.mode_proc='#{@po.mode_proc}'" ng-model="po.mode_proc"
  36.                     option value=""
  37.                       | Choose...
  38.                     option value="Shopping" ng-selected="po.mode_proc == '#{@po.mode_proc}'"
  39.                       | Shopping
  40.                     option value="Small Value Procurement" ng-selected="po.mode_proc == '#{@po.mode_proc}'"
  41.                       | Small Value Procurement
  42.  
  43.               .form-group.row ng-init="po.po_date='#{@po.po_date}'"
  44.                 label.col-sm-3.col-form-label
  45.                   | PO Date
  46.                 .col-sm-5
  47.                   input.form-control.format-po-num date-input="" type="date" ng-model="po.po_date" ng-model-options="{timezone:'UTC'}"
  48.  
  49.     - @pr.purchase_orders.each_with_index do |s,i|
  50.       .row
  51.         .col-md-12
  52.           .card
  53.             .card-body
  54.               form
  55.  
  56.                 .form-group.row
  57.                   label.col-sm-3.col-form-label
  58.                     | Supplier:
  59.                   .col-sm-9
  60.                     input.form-control-plaintext readonly="" value="#{s.supplier_name}" ng-init="po.suppliers[#{i}].supplier_name='#{s.supplier_name}'"
  61.  
  62.                 .form-group.row ng-init="po.suppliers[#{i}].supplier_address='#{s.supplier_address}'"
  63.                   label.col-sm-3.col-form-label
  64.                     | Address
  65.                   .col-sm-9
  66.                     input.form-control placeholder="ie. TAGUM CITY" ng-model="po.suppliers[#{i}].supplier_address"
  67.  
  68.                 .form-group.row ng-init="po.suppliers[#{i}].po_number='#{s.po_number}'"
  69.                   label.col-sm-3.col-form-label
  70.                     | PO No.
  71.                   .col-sm-5
  72.                     input.form-control.format-po-num placeholder="00-00-0000" ng-model="po.suppliers[#{i}].po_number"
  73.  
  74.                 .text-center
  75.  
  76.                   button.btn.btn-light.rounded-circle.po-update poid="#{s.id}" arrindex="#{i}" type="button"
  77.                     i.text-primary.fas.fa-check
  78.  
  79.                   a.float-right href="/po/#{s.id}.pdf" target="_blank" style="margin-top:10px;"
  80.                     i.far.fa-file-pdf.fa-lg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement