<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <record id="sos_fg_plan_view_tree" model="ir.ui.view">
        <field name="name">sos_fg_plan.view.tree</field>
        <field name="model">sos_fg_plan</field>
        <field name="arch" type="xml">

            <tree>
                <field name="plan_ref_no"/>
<field name="indent_status" widget="badge" 
    decoration-success="indent_status == 'close'"
    decoration-warning="indent_status == 'hold'"
    decoration-danger="indent_status == 'open' or indent_status == 'cancel'"
/>
                <field name="approved_by" string="Approved By" widget="many2one_avatar_user"/>
               
            </tree>
        </field>
    </record>
        
 <record id="action_fg_plan_list" model="ir.actions.act_window">
    <field name="name">Indent Plan</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">sos_fg_plan</field>
    <field name="view_mode">tree,form,kanban</field>
    <field name="view_id" ref="sos_fg_plan_view_tree"/>
       <field name="help" type="html">
        <p class="o_view_nocontent_smiling_face">
        No Plan Found
        </p>
        </field>
</record>
<record id="view_fg_plan_form" model="ir.ui.view">
    <field name="name">sos_fg_plan.form</field>
    <field name="model">sos_fg_plan</field>
    <field name="arch" type="xml">
        <form string="FG Plan">
            <sheet>
      <widget name="web_ribbon" text="Open" bg_color="bg-danger" invisible="indent_status == 'cancel'"/>
      <widget name="web_ribbon" text="Closed / Hold" bg_color="bg-success" invisible="indent_status == 'open'"/>
      
    <div style="font-size: 22px;pointer-events: none;color: #793595;margin-bottom: 20px;">
        <field name="plan_ref_no" nolabel="1" />
         <field name="approved_by" invisible="True" />
    </div>
    <group>
    <group>
    <field name="indent_start_date" readonly="1"/>
    <field name="target_date"/>
        <field name="blowup" invisible="1"/>

    
</group>

     </group>
   <field name="indent_status" invisible="True" widget="badge" decoration-success = "indent_status == 'cancel'" decoration-warning = "indent_status == 'hold'" decoration-danger = "indent_status == 'open'"/>
  <h3>Actions</h3>
  <hr></hr>
  <div class="row">
  <div class="col-3">
  <table class="table_custom" style="border:none">
  <tr>
  <td style="border:none"><button type="object" string="Export" class="btn-warning" name="action_export_final"></button></td>
  <td style="border:none" invisible="blowup"><button string="Blowup" style="margin-left:20px" class="btn-primary custom_btn" type="object" name="action_report_esign_btn"></button></td>
  <td style="border:none"><button string="Cancel / Hold"  style="margin-left:20px" type="object" name="open_reason_wizard" class="btn-danger" /></td>
  </tr>
  </table>
      </div></div>
 <br></br> <br></br>

  

                
                <notebook>
                <!-- FG pages -->
                  <page string="FG Plan"  id="page1" invisible="approved_by == False">
    
    <field name="line_ids">
    <tree editable="bottom" create="false" edit="false" delete="false">
    <field name="fg_name"/>
    <field name="approved_cnt" decoration-bf="approved_cnt > 0"  decoration-primary="approved_cnt > 0" />
    <field name="planned_week_1"/>
    <field name="planned_week_2"/> 
    <field name="planned_week_3"/>
    <field name="planned_week_4"/>
    <field name="planned_week_5"/>
    <field name="planned_week_6"/> 
    <field name="planned_week_7"/>
    <field name="planned_week_8"/>
    <field name="completed_qty"  decoration-bf="completed_qty > 0"  decoration-success="completed_qty > 0"  />
    
    </tree>
    </field>
   
    </page>
    <page string="FG Plan"  id="page1"  invisible="approved_by">
    <field name="line_ids">
    <tree editable="bottom">
    <field name="fg_name"/> 
     <field name="actual_required_qty"/>
    <field name="minimum_order_qty"/>
    <field name="approved_cnt" decoration-bf="approved_cnt > 0"  decoration-success="approved_cnt > 0" />
    </tree>
    </field>
   
    </page>
     <!-- FG pages End-->

            <page string="SFG Plan">
            <field name="sfg_line_ids">
            <tree editable="bottom">
            <!-- <field name="fg_name"/> -->
            <field name="sfg_name"/>
            <field name="blowup_action"/>
            <field name="assembling_cost"/>
            <!-- <field name="required_qty"/>
            <field name="minimum_stock_qty"/>  -->
            <field name="total_assembling_cost"/>
            <field name="actual_required_qty"/>
            <field name="minimum_order_qty"/>
            <field name="approved_cnt" decoration-bf="approved_cnt > 0"  decoration-success="approved_cnt > 0" />

            </tree>
            </field>
            <div class="oe_subtotal_footer" style="float: right;
    padding: 20px;
    border: solid 1px #ccc;
    font-weight: bold;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;">

    <!-- Gross Value Field -->
    <div style="margin-bottom: 5px;">
        <label for="estimated_assembling_charges" style="font-weight: bold; margin-right: 10px;">Total Assembling Charges</label>
        <field name="estimated_assembling_charges" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/>
    </div>
    </div>
            
            </page>
                <page string="Material Plan">
                <field name="material_line_ids">
                <tree editable="bottom">
                <field name="material_name"/>
                <field name="inhand_qty" string="Inhand Qty"/>
                <field name="approx_price"/>
                 <field name="actual_required_qty"/>
               <field name="minimum_order_qty"/>
                <!--<field name="required_qty"/>
                <field name="minimum_stock_qty"/>                               -->
                <field name="total_approx_price"/>
            <field name="approved_cnt" decoration-bf="approved_cnt > 0"  decoration-success="approved_cnt > 0" />

                </tree>
                </field>
                <div class="oe_subtotal_footer" style="float: right;
    padding: 20px;
    border: solid 1px #ccc;
    font-weight: bold;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;">

    <div style="margin-bottom: 5px;">
        <label for="estimated_material_cost" style="font-weight: bold; margin-right: 10px;">Total Cost</label>
        <field name="estimated_material_cost" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/>
    </div>
    </div>
                </page>
                <page string="Budget Estimation">
                <group>
                <field name="estimated_assembling_charges" widget="monetary"/>
                </group>
                <group>
                <field name="estimated_material_cost"/>
                </group>
                <group>
                <field name="other_charges"/>
                </group>
                <group>
                <field name="tax_value"/>
              <field name="overall_total" string="Overall Estimated Cost" style="font-size:22px;font-weight:bold"/>

                </group>
                </page>
                  </notebook>
                 <br></br>
    <templates>
     <div class="row" style="margin-top:100px">

  <div class="col-4"> <table class="table_custom">
        <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>Prepared By Sign</b>
                <button string="Approve" invisible="prepared_image" class="btn-primary custom_btn" type="object" name="action_approve_esign_btn"></button>
            </td>
            <td><field name="prepared_image" widget="image"/></td>
        </tr>
        <tr invisible="prepared_image == False">
            <td style="padding: 8px;" class="column"><b>Prepared On</b></td>
            <td><field name="prepared_on" readonly="1"/></td>
        </tr>
        <tr invisible="prepared_image == False">
            <td style="padding: 8px;" class="column"><b>Prepared By</b></td>
            <td><field name="prepared_by" readonly="1"/></td>
        </tr>
    </table> </div>
    <div class="col-4"> </div>
  <div class="col-4">
      <table class="table_custom">
        <tr style="border-bottom: solid 1px #ccc;">
            <td style="padding: 8px;" class="column"><b>Top Management Approval Sign</b>
                <button string="Approve" invisible="approval_image" class="btn-primary custom_btn" type="object" name="action_top_approver_esign_btn"></button>
            </td>
            <td><field name="approval_image" widget="image"/></td>
        </tr>
        <tr invisible="approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved On</b></td>
            <td><field name="approved_on" readonly="1"/></td>
        </tr>
        <tr invisible="approval_image == False">
            <td style="padding: 8px;" class="column"><b>Approved By</b></td>
            <td><field name="approved_by" readonly="1"/></td>
        </tr>
    </table> </div>
  </div>

    </templates>
              


            </sheet>
        </form>
    </field>
</record>

 <menuitem id="fg_plan_menu"
              name="Indent Plan"
              parent="indent_menu_root"
              action = "action_fg_plan_list"/>
              
</odoo>
