umwd-components 0.1.671 → 0.1.672

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.671",
3
+ "version": "0.1.672",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/src/index.js",
@@ -149,6 +149,7 @@ export function AddVendorForm({
149
149
  <Grid item xs={12}>
150
150
  <Typography variant="h6">Contacts</Typography>
151
151
  </Grid>
152
+
152
153
  {newContacts.map((contact, index) => {
153
154
  return (
154
155
  <Grid
@@ -187,6 +188,7 @@ export function AddVendorForm({
187
188
  </Grid>
188
189
  );
189
190
  })}
191
+
190
192
  <Grid
191
193
  item
192
194
  xs={12}
@@ -201,38 +201,84 @@ export function EditVendorForm({
201
201
  if (contact.data?.id) {
202
202
  if (open.includes(contact.data?.id)) {
203
203
  return (
204
- <Grid item xs={12} md={6} lg={4} key={contact.data.id}>
205
- <ContactsFields
206
- data={contact.data}
207
- componentName={`contacts[${index}]`}
208
- componentReference="logistics-elements.contact"
209
- deleteCallback={() => {
210
- setOldContacts(
211
- oldContacts.filter((_, i) => i !== index)
212
- );
213
- /* setOpen(
204
+ <Grid
205
+ item
206
+ xs={12}
207
+ sm={6}
208
+ md={4}
209
+ lg={3}
210
+ sx={{
211
+ justifyContent: "center",
212
+ display: "flex",
213
+ alignItems: "center",
214
+ }}
215
+ key={contact.data.id}
216
+ >
217
+ <Paper
218
+ sx={{
219
+ p: 2,
220
+ width: "100%",
221
+ display: "flex",
222
+ justifyContent: "center",
223
+ alignItems: "center",
224
+ height: "100%",
225
+ }}
226
+ >
227
+ <ContactsFields
228
+ data={contact.data}
229
+ componentName={`contacts[${index}]`}
230
+ componentReference="logistics-elements.contact"
231
+ deleteCallback={() => {
232
+ setOldContacts(
233
+ oldContacts.filter((_, i) => i !== index)
234
+ );
235
+ /* setOpen(
214
236
  open.filter((openId) => openId !== contact.data?.id)
215
237
  ); */
216
- }}
217
- />
238
+ }}
239
+ />
240
+ </Paper>
218
241
  </Grid>
219
242
  );
220
243
  } else {
221
244
  return (
222
- <Grid item xs={12} md={6} lg={4} key={contact.data.id}>
223
- <input
224
- type="hidden"
225
- name={`contacts[${index}].id`}
226
- value={contact.data.id}
227
- />
228
- <input
229
- type="hidden"
230
- name={`contacts[${index}].__component`}
231
- value="logistics-elements.contact"
232
- />
233
- <Contacts
234
- data={{ ...contact.data, onClick: onClickHandler }}
235
- />
245
+ <Grid
246
+ item
247
+ xs={12}
248
+ sm={6}
249
+ md={4}
250
+ lg={3}
251
+ sx={{
252
+ justifyContent: "center",
253
+ display: "flex",
254
+ alignItems: "center",
255
+ }}
256
+ key={contact.data.id}
257
+ >
258
+ <Paper
259
+ sx={{
260
+ p: 2,
261
+ width: "100%",
262
+ display: "flex",
263
+ justifyContent: "center",
264
+ alignItems: "center",
265
+ height: "100%",
266
+ }}
267
+ >
268
+ <input
269
+ type="hidden"
270
+ name={`contacts[${index}].id`}
271
+ value={contact.data.id}
272
+ />
273
+ <input
274
+ type="hidden"
275
+ name={`contacts[${index}].__component`}
276
+ value="logistics-elements.contact"
277
+ />
278
+ <Contacts
279
+ data={{ ...contact.data, onClick: onClickHandler }}
280
+ />
281
+ </Paper>
236
282
  </Grid>
237
283
  );
238
284
  }
@@ -241,60 +287,101 @@ export function EditVendorForm({
241
287
  })}
242
288
  {newContacts.map((contact, index) => {
243
289
  return (
244
- <Grid item xs={12} md={6} lg={4} key={contact.data?.uuid}>
245
- <ContactsFields
246
- data={contact.data}
247
- componentName={contact.componentName}
248
- componentReference="logistics-elements.contact"
249
- deleteCallback={() => {
250
- setNewContacts(
251
- newContacts
252
- .filter((_, i) => i !== index)
253
- .map((_, i) => {
254
- return {
255
- ..._,
256
- componentName: `contacts[${
257
- i + oldContacts.length
258
- }]`,
259
- };
260
- })
261
- );
290
+ <Grid
291
+ item
292
+ xs={12}
293
+ sm={6}
294
+ md={4}
295
+ lg={3}
296
+ sx={{
297
+ justifyContent: "center",
298
+ display: "flex",
299
+ alignItems: "center",
300
+ }}
301
+ key={contact.data?.id || index}
302
+ >
303
+ <Paper
304
+ sx={{
305
+ p: 2,
306
+ width: "100%",
307
+ display: "flex",
308
+ justifyContent: "center",
309
+ alignItems: "center",
310
+ height: "100%",
262
311
  }}
263
- />
312
+ >
313
+ <ContactsFields
314
+ data={contact.data}
315
+ componentName={contact.componentName}
316
+ componentReference="logistics-elements.contact"
317
+ deleteCallback={() => {
318
+ setNewContacts(
319
+ newContacts
320
+ .filter((_, i) => i !== index)
321
+ .map((_, i) => {
322
+ return {
323
+ ..._,
324
+ componentName: `contacts[${
325
+ i + oldContacts.length
326
+ }]`,
327
+ };
328
+ })
329
+ );
330
+ }}
331
+ />
332
+ </Paper>
264
333
  </Grid>
265
334
  );
266
335
  })}
267
336
  <Grid
268
337
  item
269
338
  xs={12}
270
- md={6}
271
- lg={4}
272
- justifyContent={"center"}
273
- alignItems={"center"}
339
+ sm={6}
340
+ md={4}
341
+ lg={3}
342
+ sx={{
343
+ justifyContent: "center",
344
+ display: "flex",
345
+ alignItems: "center",
346
+ }}
274
347
  >
275
- <IconButton
276
- onClick={() => {
277
- setNewContacts([
278
- ...newContacts,
279
- {
280
- componentName: `contacts[${
281
- oldContacts.length + newContacts.length
282
- }]`,
283
- componentReference: "logistics-elements.contact",
284
- data: {
285
- uuid: Math.random(),
286
- first_name: "",
287
- last_name: "",
288
- email: "",
289
- phone_number: "",
290
- type: ContactType.Other,
291
- },
292
- },
293
- ]);
348
+ <Paper
349
+ sx={{
350
+ p: 2,
351
+ width: "100%",
352
+ display: "flex",
353
+ justifyContent: "center",
354
+ alignItems: "center",
355
+ height: "100%",
294
356
  }}
295
357
  >
296
- <AddIcon />
297
- </IconButton>
358
+ <Button
359
+ variant={"contained"}
360
+ startIcon={<AddIcon />}
361
+ onClick={() => {
362
+ setNewContacts([
363
+ ...newContacts,
364
+ {
365
+ componentName: `contacts[${
366
+ oldContacts.length + newContacts.length
367
+ }]`,
368
+ componentReference: "logistics-elements.contact",
369
+ data: {
370
+ uuid: Math.random(),
371
+ first_name: "",
372
+ last_name: "",
373
+ email: "",
374
+ phone_number: "",
375
+ type: ContactType.Other,
376
+ },
377
+ },
378
+ ]);
379
+ }}
380
+ size="large"
381
+ >
382
+ Add contact
383
+ </Button>
384
+ </Paper>
298
385
  </Grid>
299
386
  <Grid item xs={12}>
300
387
  <Typography variant="h6">Notes</Typography>