|
29 | 29 | </small> |
30 | 30 | </div> |
31 | 31 |
|
32 | | - <div class="form-group"> |
33 | | - <label for="barcode">Barcode</label> |
34 | | - <input type="text" class="form-control" id="barcode" name="barcode" |
35 | | - placeholder="Scan or enter barcode (optional)"/> |
36 | | - </div> |
| 32 | + <!-- Barcode hidden - system auto-generates temp barcode --> |
| 33 | + <!-- A ZPL template will be used to print temp barcodes like containers --> |
37 | 34 |
|
38 | 35 | <div class="form-group"> |
39 | 36 | <label for="container_id">Container *</label> |
40 | | - <select class="form-control" id="container_id" name="container_id" required="required"> |
41 | | - <option value="">-- Select Container --</option> |
| 37 | + <select class="form-control" id="container_id" name="container_id" required="required" |
| 38 | + onchange="updateDepartmentFromContainer(this)"> |
| 39 | + <option value="" data-department="">-- Select Container --</option> |
42 | 40 | <t t-foreach="containers" t-as="container"> |
43 | 41 | <option t-att-value="container.id" |
| 42 | + t-att-data-department="container.department_id.name or ''" |
| 43 | + t-att-data-department-id="container.department_id.id or ''" |
44 | 44 | t-att-selected="preselect_container_id and container.id == preselect_container_id"> |
45 | 45 | <t t-esc="container.name"/> |
46 | | - <t t-if="container.location_id"> - <t t-esc="container.location_id.name"/></t> |
| 46 | + <t t-if="container.barcode"> (<t t-esc="container.barcode"/>)</t> |
47 | 47 | </option> |
48 | 48 | </t> |
49 | 49 | </select> |
|
52 | 52 | </small> |
53 | 53 | </div> |
54 | 54 |
|
55 | | - <!-- Smart Department Selection --> |
56 | | - <t t-if="has_departments"> |
57 | | - <div class="form-group"> |
58 | | - <label for="department_id">Department</label> |
59 | | - |
60 | | - <!-- Case 1: User has exactly one department - show read-only --> |
61 | | - <t t-if="default_department and not show_department_selector"> |
62 | | - <input type="text" class="form-control" readonly="readonly" |
63 | | - t-att-value="default_department.name"/> |
64 | | - <input type="hidden" name="department_id" t-att-value="default_department.id"/> |
65 | | - <small class="form-text text-muted">Your assigned department</small> |
66 | | - </t> |
67 | | - |
68 | | - <!-- Case 2: User has multiple departments - show dropdown --> |
69 | | - <t t-elif="show_department_selector"> |
70 | | - <select class="form-control" id="department_id" name="department_id"> |
71 | | - <option value="">-- Select Department --</option> |
72 | | - <t t-foreach="departments" t-as="dept"> |
73 | | - <option t-att-value="dept.id"><t t-esc="dept.name"/></option> |
74 | | - </t> |
75 | | - </select> |
76 | | - </t> |
77 | | - |
78 | | - <!-- Case 3: Company has departments but user has no access --> |
79 | | - <t t-else=""> |
80 | | - <input type="text" class="form-control text-muted" readonly="readonly" |
81 | | - value="Company Level"/> |
82 | | - <input type="hidden" name="department_id" value=""/> |
83 | | - <small class="form-text text-muted">File will be at company level</small> |
84 | | - </t> |
85 | | - </div> |
86 | | - </t> |
| 55 | + <!-- Department - Read-only, inherited from container --> |
| 56 | + <div class="form-group"> |
| 57 | + <label for="department_display">Department</label> |
| 58 | + <input type="text" class="form-control bg-light" id="department_display" |
| 59 | + readonly="readonly" placeholder="Select a container first"/> |
| 60 | + <input type="hidden" name="department_id" id="department_id" value=""/> |
| 61 | + <small class="form-text text-muted"> |
| 62 | + Department is inherited from the selected container |
| 63 | + </small> |
| 64 | + </div> |
87 | 65 |
|
88 | 66 | <div class="form-group"> |
89 | 67 | <label for="file_category">File Category</label> |
90 | 68 | <select class="form-control" id="file_category" name="file_category"> |
91 | 69 | <option value="">-- Select Category --</option> |
92 | | - <option value="permanent">Permanent</option> |
93 | | - <option value="temporary">Temporary</option> |
94 | | - <option value="archived">Archived</option> |
95 | | - <option value="active" selected="selected">Active</option> |
| 70 | + <t t-foreach="file_categories or []" t-as="cat"> |
| 71 | + <option t-att-value="cat[0]"><t t-esc="cat[1]"/></option> |
| 72 | + </t> |
96 | 73 | </select> |
97 | 74 | <small class="form-text text-muted"> |
98 | 75 | Categorize this file for organizational purposes |
99 | 76 | </small> |
100 | 77 | </div> |
101 | 78 |
|
| 79 | + <!-- File State - Read-only, defaults to container state or 'pending' --> |
102 | 80 | <div class="form-group"> |
103 | | - <label for="state">File State</label> |
104 | | - <select class="form-control" id="state" name="state"> |
105 | | - <option value="draft">Draft</option> |
106 | | - <option value="active" selected="selected">Active</option> |
107 | | - <option value="archived">Archived</option> |
108 | | - </select> |
| 81 | + <label for="state_display">File State</label> |
| 82 | + <input type="text" class="form-control bg-light" id="state_display" |
| 83 | + value="Pending" readonly="readonly"/> |
| 84 | + <small class="form-text text-muted"> |
| 85 | + File state is set automatically. It will change to "In Storage" when received at warehouse. |
| 86 | + </small> |
109 | 87 | </div> |
110 | 88 |
|
111 | | - <div class="row"> |
112 | | - <div class="col-md-6"> |
113 | | - <div class="form-group"> |
114 | | - <label for="date_created">Date Created</label> |
115 | | - <input type="date" class="form-control" id="date_created" name="date_created"/> |
116 | | - <small class="form-text text-muted"> |
117 | | - When this file was originally created |
118 | | - </small> |
119 | | - </div> |
120 | | - </div> |
121 | | - <div class="col-md-6"> |
122 | | - <div class="form-group"> |
123 | | - <label for="received_date">Date Received</label> |
124 | | - <input type="date" class="form-control" id="received_date" name="received_date"/> |
125 | | - <small class="form-text text-muted"> |
126 | | - When this file was received into custody |
127 | | - </small> |
128 | | - </div> |
129 | | - </div> |
| 89 | + <!-- Only Date Created - defaults to today, Date Received is set by technician --> |
| 90 | + <div class="form-group"> |
| 91 | + <label for="date_created">Date Created</label> |
| 92 | + <input type="date" class="form-control" id="date_created" name="date_created" |
| 93 | + t-att-value="today"/> |
| 94 | + <small class="form-text text-muted"> |
| 95 | + When this file was originally created (defaults to today) |
| 96 | + </small> |
130 | 97 | </div> |
| 98 | + <!-- Date Received hidden - set when technician scans container to work order --> |
131 | 99 |
|
132 | 100 | <div class="form-group"> |
133 | 101 | <label for="description">Description</label> |
134 | 102 | <textarea class="form-control" id="description" name="description" rows="3" |
135 | 103 | placeholder="Optional: Describe the contents of this file"></textarea> |
136 | 104 | </div> |
137 | 105 |
|
138 | | - <!-- Temporary Location Info (Customer fills this - we assign real stock location via scan) --> |
| 106 | + <!-- Temporary Location Info --> |
139 | 107 | <div class="alert alert-info mt-3"> |
140 | 108 | <h6><i class="fa fa-info-circle"></i> Location Information</h6> |
141 | 109 | <p class="mb-0 small"> |
142 | | - This file will be assigned a temporary location at your address/department. |
143 | | - Our staff will assign the actual warehouse location when the file is scanned into inventory. |
| 110 | + This file will be assigned a temporary barcode for tracking. |
| 111 | + Our staff will assign the permanent barcode and warehouse location when the file is scanned into inventory. |
144 | 112 | </p> |
145 | 113 | </div> |
146 | 114 |
|
|
153 | 121 | </a> |
154 | 122 | </div> |
155 | 123 | </form> |
| 124 | + |
| 125 | + <!-- JavaScript to update department from container --> |
| 126 | + <script> |
| 127 | + function updateDepartmentFromContainer(select) { |
| 128 | + var option = select.options[select.selectedIndex]; |
| 129 | + var deptName = option.getAttribute('data-department') || ''; |
| 130 | + var deptId = option.getAttribute('data-department-id') || ''; |
| 131 | + |
| 132 | + document.getElementById('department_display').value = deptName || 'No department assigned'; |
| 133 | + document.getElementById('department_id').value = deptId; |
| 134 | + } |
| 135 | + |
| 136 | + // Initialize on page load if container is pre-selected |
| 137 | + document.addEventListener('DOMContentLoaded', function() { |
| 138 | + var containerSelect = document.getElementById('container_id'); |
| 139 | + if (containerSelect.value) { |
| 140 | + updateDepartmentFromContainer(containerSelect); |
| 141 | + } |
| 142 | + }); |
| 143 | + </script> |
156 | 144 |
|
157 | 145 | <!-- Help Section --> |
158 | 146 | <div class="mt-4 pt-3 border-top"> |
|
161 | 149 | </h6> |
162 | 150 | <ul class="small text-muted"> |
163 | 151 | <li><strong>File Name:</strong> Enter a descriptive name for easy identification</li> |
164 | | - <li><strong>Barcode:</strong> Scan or manually enter barcode if available</li> |
165 | 152 | <li><strong>Container:</strong> Select the physical container this file belongs to</li> |
166 | | - <li><strong>Department:</strong> Assign to appropriate department</li> |
| 153 | + <li><strong>Department:</strong> Automatically set from the container's department</li> |
| 154 | + <li><strong>Category:</strong> Choose the type of records in this file</li> |
167 | 155 | </ul> |
168 | 156 | </div> |
169 | 157 | </div> |
|
0 commit comments